Unable to locate package caffe-cpu

6,145

Solution 1

caffe-cpu is in the default Ubuntu repositories in Ubuntu 18.04 and later. Upgrade to Ubuntu 18.04 and you can install caffe-cpu with the following command:

sudo apt update  
sudo apt install caffe-cpu

Results of apt-cache showpkg caffe-cpu in Ubuntu 18.04:

Reverse Depends: 
  caffe-cuda,caffe-cpu
  caffe-cpu:i386,caffe-cpu
  science-machine-learning,caffe-cpu
Dependencies: 
1.0.0-6 - caffe-tools-cpu (5 1.0.0-6) python3-caffe-cpu (5 1.0.0-6) libcaffe-cpu1 (5 1.0.0-6) libopenblas-base (16 (null)) libatlas3-base (16 (null)) libblas.so.3 (0 (null)) caffe-cuda (0 (null)) libcaffe-cpu-dev (5 1.0.0-6) caffe-doc (5 1.0.0-6) caffe-cpu:i386 (32 (null)) 
Provides: 
1.0.0-6 - 
$ sudo apt-get install -s caffe-cpu
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  caffe-tools-cpu libboost-python1.65.1 libcaffe-cpu1 libgflags2.2
  libgoogle-glog0v5 libleveldb1v5 liblmdb0 python3-caffe-cpu python3-gflags
  python3-leveldb
Suggested packages:
  libcaffe-cpu-dev caffe-doc
The following NEW packages will be installed:
  caffe-cpu caffe-tools-cpu libboost-python1.65.1 libcaffe-cpu1 libgflags2.2
  libgoogle-glog0v5 libleveldb1v5 liblmdb0 python3-caffe-cpu python3-gflags
  python3-leveldb
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Inst libboost-python1.65.1 (1.65.1+dfsg-0ubuntu5 Ubuntu:18.04/bionic [amd64])
Inst libgflags2.2 (2.2.1-1 Ubuntu:18.04/bionic [amd64])
Inst libgoogle-glog0v5 (0.3.5-1 Ubuntu:18.04/bionic [amd64])
Inst libleveldb1v5 (1.20-2 Ubuntu:18.04/bionic [amd64])
Inst liblmdb0 (0.9.21-1 Ubuntu:18.04/bionic [amd64])
Inst libcaffe-cpu1 (1.0.0-6 Ubuntu:18.04/bionic [amd64])
Inst caffe-tools-cpu (1.0.0-6 Ubuntu:18.04/bionic [amd64])
Inst python3-gflags (1.5.1-5 Ubuntu:18.04/bionic [all])
Inst python3-leveldb (0~svn68-3build3 Ubuntu:18.04/bionic [amd64])
Inst python3-caffe-cpu (1.0.0-6 Ubuntu:18.04/bionic [amd64])
Inst caffe-cpu (1.0.0-6 Ubuntu:18.04/bionic [amd64])
Conf libboost-python1.65.1 (1.65.1+dfsg-0ubuntu5 Ubuntu:18.04/bionic [amd64])
Conf libgflags2.2 (2.2.1-1 Ubuntu:18.04/bionic [amd64])
Conf libgoogle-glog0v5 (0.3.5-1 Ubuntu:18.04/bionic [amd64])
Conf libleveldb1v5 (1.20-2 Ubuntu:18.04/bionic [amd64])
Conf liblmdb0 (0.9.21-1 Ubuntu:18.04/bionic [amd64])
Conf libcaffe-cpu1 (1.0.0-6 Ubuntu:18.04/bionic [amd64])
Conf caffe-tools-cpu (1.0.0-6 Ubuntu:18.04/bionic [amd64])
Conf python3-gflags (1.5.1-5 Ubuntu:18.04/bionic [all])
Conf python3-leveldb (0~svn68-3build3 Ubuntu:18.04/bionic [amd64])
Conf python3-caffe-cpu (1.0.0-6 Ubuntu:18.04/bionic [amd64])
Conf caffe-cpu (1.0.0-6 Ubuntu:18.04/bionic [amd64])

Solution 2

I found the best way to get up and running is to use conda. This way allows you to have many different caffe environments. First install miniconda, then make an environment

conda create -n caffe

then

conda install caffe

OR

conda install caffe-gpu

Not only does conda solve all the dependencies but it also installs the correct version of cudatoolkit and cudnn. And if you want python 2 you can

conda create -n python2Caffe-GPU python=2.7

conda install caffe-gpu=1.0=py27heda4471_3

The variable, py27heda4471_3, is the build version and you have many to choose from

conda search caffe-gpu

gives a list

Share:
6,145

Related videos on Youtube

Baron Yugovich
Author by

Baron Yugovich

Updated on September 18, 2022

Comments

  • Baron Yugovich
    Baron Yugovich over 1 year

    I am trying to install caffe, but ran into the following error

    sudo apt-get install caffe-cpu
    [sudo] password for : 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Unable to locate package caffe-cpu
    

    This is my version:

    lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 16.04.4 LTS
    Release:    16.04
    Codename:   xenial
    

    I tried following the instructions here https://chunml.github.io/ChunML.github.io/project/Installing-Caffe-CPU-Only/

    Got

    CXX src/caffe/test/test_hdf5_output_layer.cpp
    In file included from src/caffe/test/test_hdf5_output_layer.cpp:8:0:
    ./include/caffe/layers/hdf5_output_layer.hpp:4:18: fatal error: hdf5.h: No such file or directory
    compilation terminated.
    Makefile:581: recipe for target '.build_release/src/caffe/test/test_hdf5_output_layer.o' failed
    make: *** [.build_release/src/caffe/test/test_hdf5_output_layer.o] Error 1
    

    This is what I have

      ThinkPad-T520:/usr/lib/x86_64-linux-gnu$ ls -al | grep libhdf5_serial
        lrwxrwxrwx   1 root root        53 Jul 19 10:03 libhdf5_hl.so -> /usr/lib/x86_64-linux-gnu/libhdf5_serial_hl.so.10.0.2
        -rw-r--r--   1 root root  19953086 Apr  5  2016 libhdf5_serial.a
        -rw-r--r--   1 root root   1659560 Apr  5  2016 libhdf5_serial_fortran.a
        lrwxrwxrwx   1 root root        32 Apr  5  2016 libhdf5_serial_fortran.so -> libhdf5_serial_fortran.so.10.0.2
        lrwxrwxrwx   1 root root        32 Apr  5  2016 libhdf5_serial_fortran.so.10 -> libhdf5_serial_fortran.so.10.0.2
        -rw-r--r--   1 root root    238408 Apr  5  2016 libhdf5_serial_fortran.so.10.0.2
        -rw-r--r--   1 root root    878832 Apr  5  2016 libhdf5_serial_hl.a
        -rw-r--r--   1 root root    515320 Apr  5  2016 libhdf5_serialhl_fortran.a
        lrwxrwxrwx   1 root root        34 Apr  5  2016 libhdf5_serialhl_fortran.so -> libhdf5_serialhl_fortran.so.10.0.2
        lrwxrwxrwx   1 root root        34 Apr  5  2016 libhdf5_serialhl_fortran.so.10 -> libhdf5_serialhl_fortran.so.10.0.2
        -rw-r--r--   1 root root     80520 Apr  5  2016 libhdf5_serialhl_fortran.so.10.0.2
        lrwxrwxrwx   1 root root        27 Apr  5  2016 libhdf5_serial_hl.so -> libhdf5_serial_hl.so.10.0.2
        lrwxrwxrwx   1 root root        27 Apr  5  2016 libhdf5_serial_hl.so.10 -> libhdf5_serial_hl.so.10.0.2
        -rw-r--r--   1 root root    126232 Apr  5  2016 libhdf5_serial_hl.so.10.0.2
        -rw-r--r--   1 root root      3859 Apr  5  2016 libhdf5_serial.settings
        lrwxrwxrwx   1 root root        24 Apr  5  2016 libhdf5_serial.so -> libhdf5_serial.so.10.1.0
        lrwxrwxrwx   1 root root        24 Apr  5  2016 libhdf5_serial.so.10 -> libhdf5_serial.so.10.1.0
        -rw-r--r--   1 root root   2734288 Apr  5  2016 libhdf5_serial.so.10.1.0
        lrwxrwxrwx   1 root root        50 Jul 19 10:03 libhdf5.so -> /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.10.1.0
    

    After making changes to Makefine.config, getting

    CXX src/caffe/util/hdf5.cpp
    CXX src/caffe/util/benchmark.cpp
    CXX src/caffe/internal_thread.cpp
    CXX src/caffe/layer.cpp
    CXX src/caffe/layer_factory.cpp
    LD -o .build_release/lib/libcaffe.so.1.0.0
    /usr/bin/ld: cannot find -lopencv_imgcodecs
    /usr/bin/ld: cannot find -lcblas
    /usr/bin/ld: cannot find -latlas
    collect2: error: ld returned 1 exit status
    Makefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
    make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
    
    • Terrance
      Terrance almost 6 years
      That is because it is not in the repositories. See: chunml.github.io/ChunML.github.io/project/…
    • Baron Yugovich
      Baron Yugovich almost 6 years
      Can you please check out my edits above? I am still getting stuck...
    • Terrance
      Terrance almost 6 years
      See: gist.github.com/nikitametha/c54e1abecff7ab53896270509da80215 and go down to where it says to resolve the hdf5 errors.
    • Baron Yugovich
      Baron Yugovich almost 6 years
      Thanks for the help! Now getting a different error, please see edit above.
    • Terrance
      Terrance almost 6 years
      Go back to the link and make sure that all the required applications are installed.
    • Baron Yugovich
      Baron Yugovich almost 6 years
      Will do, thanks. Btw, how do I check my blas version? Tried grep OPENBLAS_VERSION /usr/local/include/openblas_config.h grep: /usr/local/include/openblas_config.h: No such file or directory
    • Baron Yugovich
      Baron Yugovich almost 6 years
      Now I am getting this error CXX src/caffe/layer_factory.cpp LD -o .build_release/lib/libcaffe.so.1.0.0 /usr/bin/ld: cannot find -lopencv_imgcodecs collect2: error: ld returned 1 exit status even though I do have opencv: sudo apt-get install libopencv-dev python-opencv Reading package lists... Done Building dependency tree Reading state information... Done libopencv-dev is already the newest version (2.4.9.1+dfsg-1.5ubuntu1). python-opencv is already the newest version (2.4.9.1+dfsg-1.5ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    • Terrance
      Terrance almost 6 years
      Try running sudo ldconfig on your system to fix any ld errors. Beyond that, I am out of suggestions. I have never set this up before and this is why I have not written an answer. The links were only suggestions to follow. I wish I was more help.
    • Baron Yugovich
      Baron Yugovich almost 6 years
      No, it's been great, I wouldn't have gotten this far without you, thank you so much! I will try that and report back. Is it not an opencv issue though?
    • Baron Yugovich
      Baron Yugovich almost 6 years
      Thank you so much Terrance, thanks to your advice I was finally able to do it!
    • Terrance
      Terrance almost 6 years
      Glad you got it working! =)
  • Baron Yugovich
    Baron Yugovich almost 6 years
    so just do sudo apt-get upgrade first, or you've got other suggestions?
  • karel
    karel almost 6 years
    caffe-cpu has got a lot of dependencies that are also only in the default Ubuntu repositories for Ubuntu 18.04 and later.
  • Baron Yugovich
    Baron Yugovich almost 6 years
    A friend of mine has 18.04, and got the same error. What's going on?
  • Baron Yugovich
    Baron Yugovich almost 6 years
    Nope, getting the same error on 18.04 as well.