Skip to content

Provide a Caffe package in Debian #2601

@cdluminate

Description

@cdluminate

Status

Caffe packages are available for Debian/unstable.
Caffe packages are failing to build for Ubuntu-devel and need to be patched.

Last update: Dec.20 2016

Draft guide

Deploy Caffe with merely one command.

Brief Guide for Debian/unstable users

Only experienced linux users are recommended to try Debian/unstable (Sid).
To install caffe, first make sure you have something like the follows in file /etc/apt/sources.list:
(Uncomment the second line if you want to re-compile caffe locally.)

deb http://ftp.cn.debian.org/debian sid main contrib non-free
#deb-src http://ftp.cn.debian.org/debian sid main contrib non-free

Then update apt cache and install it. Note, you cannot install both the cpu version and the cuda version.

# apt update
# apt install [ caffe-cpu | caffe-cuda ]
# caffe

It should work out of box. I hope this work is helpful since there are many people struggling at the Caffe compiling process.

Here are some notes:

  • Please re-compile OpenBLAS locally with optimization flags for sake of performance. This is highly recommended if you are writing a paper. The way to re-compile OpenBLAS from Debian source is very similar with the next subsection.
  • If you are going to install caffe-cuda, it will automatically pull the CUDA package and the nvidia driver packages. The installation procress may fail if any part of the caffe dependency chain gets into trouble. That is to say, please take care if you have manually installed or significantly modified nvidia driver or CUDA toolkit or protobuf or any other related stuff.
  • if you encountered any problem when installing caffe-cuda on a clean Debian system, report bug to me (via Debian's bug tracking system) please.
  • If you encountered any problem when installing caffe-cpu, please report bug to me via Debian's bug tracking system.
  • Both of caffe-cpu and caffe-cuda contain a manpage (man caffe) and a bash complementation script (caffe <TAB><TAB>, caffe train <TAB><TAB>). Both of them are still not merged into caffe master.
  • The python interface is Python3 version: python3-caffe-{cpu,cuda}. No plan to support python2.

Compiling your custom caffe package on Debian/unstable

There is no promise for the content in this subsection. If you just want to compile again from the source without any change, the following should work as expected. If you want to compile it with e.g. CUDNN support, you should at least be able to read and hack the file debian/rules under the source tree (It's a Makefile).

First make sure you have a correct deb-src line in your apt source list file. Then we compile caffe with several simple commands.

# apt update
# apt install build-essential debhelper devscripts    # These are standard package building tools
# apt build-dep [ caffe-cpu | caffe-cuda ]    # the most elegant way to pull caffe build dependencies
# apt source [ caffe-cpu | caffe-cuda ]    # download the source tarball
# cd caffe-XXXX    # now we enter into the source tree
[ ... optional, make your custom changes at your own risk ... ]
# debuild -B -j4    # build caffe with 4 parallel jobs (similar to make -j4)
[ ... building ...]
# debc    # optional, if you want to check the package contents
# debi    # install the generated packages

FAQ

  1. where is caffe-cudnn?
    Due to legal reason the cudnn library cannot be redistributed. I'll be happy to make this package when CUDNN becomes re-distributable. The workaround is to install cudnn by yourself, and hack at least the debian/rules file if you really want the caffe *.deb packages with CUDNN support.

  2. how to report bug via Debian bug tracking system?
    See https://www.debian.org/Bugs/ .

  3. I installed the CPU version, what should I do if I want to switch to CUDA verison?
    sudo apt install caffe-cuda, apt's dependency resolver is smart enough for this.

  4. Where is the examples, the models and other documentation stuff?
    sudo apt install caffe-doc; dpkg -L caffe-doc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions