Caffe: Cannot install caffe with Python interface by CMake

Created on 29 Jun 2018  路  13Comments  路  Source: BVLC/caffe

Issue summary

I try to install caffe on my Mac, but it cannot install Python interface cause Not find BOOST and Doxygen. The output of CMake as follows:
````
-- Boost version: 1.67.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found gflags (include: /usr/local/include, library: /usr/local/lib/libgflags.dylib)
-- Found glog (include: /usr/local/include, library: /usr/local/lib/libglog.dylib)
-- Found PROTOBUF Compiler: /usr/local/bin/protoc
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- Found lmdb (include: /usr/local/include, library: /usr/local/lib/liblmdb.dylib)
-- Found LevelDB (include: /usr/local/include, library: /usr/local/lib/libleveldb.dylib)
-- Found Snappy (include: /usr/local/include, library: /usr/local/lib/libsnappy.dylib)
-- -- CUDA is disabled. Building without it...
-- OpenCV found (/usr/local/share/OpenCV)
-- Found vecLib as part of Accelerate.framework
-- NumPy ver. 1.14.5 found (include: /usr/local/lib/python2.7/site-packages/numpy/core/include)
-- Could NOT find Boost
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)

-- Python interface is disabled or not all required dependencies found. Building without it...

-- ***** Caffe Configuration Summary *****
-- General:
-- Version : 1.0.0
-- Git : 1.0-117-g2a1c552-dirty
-- System : Darwin
-- C++ compiler : /Library/Developer/CommandLineTools/usr/bin/c++
-- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized

-- Build type : Release

-- BUILD_SHARED_LIBS : ON
-- BUILD_python : ON
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : ON
-- USE_OPENCV : ON
-- USE_LEVELDB : ON
-- USE_LMDB : ON
-- USE_NCCL : OFF

-- ALLOW_LMDB_NOLOCK : OFF

-- Dependencies:
-- BLAS : Yes (vecLib)
-- Boost : Yes (ver. 1.67)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 3.5.1)
-- lmdb : Yes (ver. 0.9.22)
-- LevelDB : Yes (ver. 1.20)
-- Snappy : Yes (ver. 1.1.7)
-- OpenCV : Yes (ver. 3.4.1)

-- CUDA : No

-- Documentaion:
-- Doxygen : No

-- config_file :

-- Install:

-- Install path : /Users/james/Documents/caffe/build/install

-- Configuring done
CMake Error at CMakeLists.txt:105 (add_dependencies):
The dependency target "pycaffe" of target "pytest" does not exist.
-- Generating done
-- Build files have been written to: /Users/james/Documents/caffe/build
````

Steps to reproduce

mkdir build
cd build
cmake ..

Tried solutions

brew uninstall --ignore-dependencies boost boost-python
brew install --build-from-source -vd boost boost-python
and try again

System configuration

  • Operating system: Mac OS 10.12.6
  • Compiler: CMake
  • BLAS: Yes (vecLib)
  • Python version (if using pycaffe): 2.7.10

Most helpful comment

create a soft link libboost_python.so for libboost_python27.so.* or libboost_python34*.

All 13 comments

Can you try downgrading Boost to 1.66? It is quite likely that CMake does not find libboost_python, since the naming convention has been changed in Boost 1.67:
https://www.boost.org/doc/libs/1_67_0/libs/python/doc/html/rn.html

install anaconda and then add the anaconda path in makefile.configure

Run into the same problem. Did you solve this?

Can you try downgrading Boost to 1.66? It is quite likely that CMake does not find libboost_python, since the naming convention has been changed in Boost 1.67:
https://www.boost.org/doc/libs/1_67_0/libs/python/doc/html/rn.html

I tried this by downgrading Boost to 1.65 (cmake -DCPU_ONLY=ON -DBOOST_ROOT=/usr/local/Cellar/boost/1.65.1 .. ), but still the same error (The dependency target "pycaffe" of target "pytest" does not exist) comes up.

@xiaojinghu @jamesweb1 Have you guys been able to solve this Boost finding issue? I've been stuck on this problem for many days

Update from me: CMake finds Boost and Doxygen, but the

-- Python interface is disabled or not all required dependencies found. Building without it...
and
The dependency target "pycaffe" of target "pytest" does not exist.

still occur. If anyone knows how to resolve this, it would be greatly appreciated.

python 2.7 works, see this article: https://medium.com/@buffaloal/build-caffe-with-anaconda-on-macos-1070a8d0a9fe

create a soft link libboost_python.so for libboost_python27.so.* or libboost_python34*.

For Python interface is disabled or not all required dependencies found. Building without it..., I used this command and it solved this problem.
cmake -D BLAS=open -D PYTHON_EXECUTABLE=~/Develop/Anaconda2/setup/bin/python -D PYTHON_INCLUDE_DIR=~/Develop/Anaconda2/setup/include/python2.7/ -D PYTHON_PACKAGES_PATH=/home/taoxuan/Develop/Anaconda2/setup/lib/python2.7/site-packages/ -D PYTHON_LIBRARY=/home/taoxuan/Develop/Anaconda2/setup/lib/libpython2.7.so ..

Same problem here, but I think it DOES have something to do with the version of libboost_python

Did anybody was able to fix this? I am not using (and I don't want to use) conda.
EDIT: the error actually went away by installing libboost_python3 (with brew). I guess I was getting this error since my python was defaulted to v3.xx instead of v2.xx ...

libboost_python3

Hello, what command have you used?

]$ ll /usr/local/boost/lib/python
-rw-r--r-- 1 root root 614146 Aug 4 18:43 /usr/local/boost/lib/libboost_python27.a
lrwxrwxrwx 1 root root 27 Aug 4 18:45 /usr/local/boost/lib/libboost_python27.so -> libboost_python27.so.1.67.0
-rwxr-xr-x 1 root root 370368 Aug 4 18:45 /usr/local/boost/lib/libboost_python27.so.1.67.0

still not working

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erogol picture erogol  路  3Comments

weather319 picture weather319  路  3Comments

Ruhjkg picture Ruhjkg  路  3Comments

greatgao picture greatgao  路  3Comments

lixin7895123 picture lixin7895123  路  3Comments