Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caffe Installation failed #101

Closed
vinson2233 opened this issue Mar 12, 2021 · 3 comments
Closed

Caffe Installation failed #101

vinson2233 opened this issue Mar 12, 2021 · 3 comments

Comments

@vinson2233
Copy link

vinson2233 commented Mar 12, 2021

I've struggled with Caffe installation for several days. It gives me a headache with fixing one error and then moves to the next error. Can I ask for :

  • Python Version
  • CUDA Version
  • CUDNN Version
  • NCCL Version
  • OS Version
    That you guys use?

I'm using Ubuntu 16.04 inside GCP
This is information I got from cMake :

-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   thread
--   filesystem
--   chrono
--   date_time
--   atomic
-- Found gflags  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found glog    (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
-- Found PROTOBUF Compiler: /usr/bin/protoc
-- Found lmdb    (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/liblmdb.so)
-- Found LevelDB (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libleveldb.so)
-- Found Snappy  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libsnappy.so)
-- CUDA detected: 7.5
-- Found cuDNN: ver. 8.1.1 found (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Added CUDA NVCC flags for: sm_37
-- OpenCV found (/usr/share/OpenCV)
-- Found Atlas (include: /usr/include, library: /usr/lib/libatlas.so)
-- NumPy ver. 1.11.0 found (include: /usr/lib/python2.7/dist-packages/numpy/core/include)
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   python
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- 
-- ******************* Caffe Configuration Summary *******************
-- General:
--   Version           :   1.0.0-rc3
--   Git               :   514e561-dirty
--   System            :   Linux
--   C++ compiler      :   /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          :   OFF
--   USE_OPENCV        :   ON
--   USE_LEVELDB       :   ON
--   USE_LMDB          :   ON
--   USE_NCCL          :   OFF
--   ALLOW_LMDB_NOLOCK :   OFF
-- 
-- Dependencies:
--   BLAS              :   Yes (Atlas)
--   Boost             :   Yes (ver. 1.58)
--   glog              :   Yes
--   gflags            :   Yes
--   protobuf          :   Yes (ver. 2.6.1)
--   lmdb              :   Yes (ver. 0.9.17)
--   LevelDB           :   Yes (ver. 1.18)
--   Snappy            :   Yes (ver. 1.1.3)
--   OpenCV            :   Yes (ver. 2.4.9.1)
--   CUDA              :   Yes (ver. 7.5)
-- 
-- NVIDIA CUDA:
--   Target GPU(s)     :   Auto
--   GPU arch(s)       :   sm_37
--   cuDNN             :   Yes (ver. 8.1.1)
-- 
-- Python:
--   Interpreter       :   /usr/bin/python2.7 (ver. 2.7.12)
--   Libraries         :   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
--   NumPy             :   /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
-- 
-- Documentaion:
--   Doxygen           :   No
--   config_file       :   
-- 
-- Install:
--   Install path      :   /home/vinson.ciawandy/bottom-up-attention/caffe/build/install
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vinson.ciawandy/bottom-up-attention/caffe/build

This is my last error where I'm giving up the installation:

make all
[  1%] Running C++/Python protocol buffer compiler on /home/vinson.ciawandy/bottom-up-attention/caffe/src/caffe/proto/caffe.proto
Scanning dependencies of target proto
[  1%] Building CXX object src/caffe/CMakeFiles/proto.dir/__/__/include/caffe/proto/caffe.pb.cc.o
[  1%] Linking CXX static library ../../lib/libproto.a
[  1%] Built target proto
[  1%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_power_layer.cu.o
In file included from /home/vinson.ciawandy/bottom-up-attention/caffe/include/caffe/util/device_alternate.hpp:40:0,
                 from /home/vinson.ciawandy/bottom-up-attention/caffe/include/caffe/common.hpp:19,
                 from /home/vinson.ciawandy/bottom-up-attention/caffe/include/caffe/blob.hpp:8,
                 from /home/vinson.ciawandy/bottom-up-attention/caffe/include/caffe/layers/power_layer.hpp:6,
                 from /home/vinson.ciawandy/bottom-up-attention/caffe/src/caffe/layers/power_layer.cu:3:
/home/vinson.ciawandy/bottom-up-attention/caffe/include/caffe/util/cudnn.hpp:169:2: error: #endif without #if
 #endif  // CAFFE_UTIL_CUDNN_H_
  ^
CMake Error at cuda_compile_generated_power_layer.cu.o.cmake:207 (message):
  Error generating
  /home/vinson.ciawandy/bottom-up-attention/caffe/build/src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_power_layer.cu.o


src/caffe/CMakeFiles/caffe.dir/build.make:525: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_power_layer.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_power_layer.cu.o] Error 1
CMakeFiles/Makefile2:272: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Or can I just ditch the Caffe inside this repo and just use the official one?
Thanks

@SnoopyMark
Copy link

@vinson2233
Copy link
Author

@SnoopyMark I have used the code from airsplay, it indeed easy to use, but cannot use for training new images.

@vinson2233
Copy link
Author

Here's my step on how I successfully install the caffe inside this repo (March 2021). I use GCP VM with ubuntu 16.04

  1. sudo apt update
  2. sudo apt-get install git
  3. sudo apt-get install software-properties-common
  4. sudo apt-get wget
  5. sudo apt-get install build-essential
  6. wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda_9.2.148_396.37_linux
  7. sudo sh cuda_9.2.148_396.37_linux.run, leave the default, if no default just choose yes
  8. Please make sure that
 - PATH includes /usr/local/cuda-9.2/bin
 - LD_LIBRARY_PATH includes /usr/local/cuda-9.2/lib64, or, add /usr/local/cuda-9.2/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.2/bin
To uninstall the NVIDIA Driver, run nvidia-uninstall
  9. Install cudnn both developer and runtime version v7.1.4 https://developer.nvidia.com/rdp/cudnn-archive
  10. git clone https://github.com/NVIDIA/nccl, follow their instruction to build, and then install
  11. Follow https://atinesh.medium.com/caffe-installation-on-ubuntu-18-04-lts-python-2-7-8e8c388ce51f for dependencies installation
  12. pip install easydict and pip install Cython
  13. git clone https://github.com/peteanderson80/bottom-up-attention
  14. follow step-3 until before make and use caffe inside peteanderson bottom up .https://atinesh.medium.com/caffe-installation-on-ubuntu-18-04-lts-python-2-7-8e8c388ce51f , but don’t uncomment the open cv version line since we use opencv2
  15. update cudnn.hpp inside peteanderson’s caffe, see details : warning message when compile BVLC/caffe#6381
  16. make all, make test and then make runtest inside caffe
  17. sudo apt-get install python-skimage
  18. final-step :), add this environment variable inside .bashrc
export PYTHONPATH=/home/username/caffe/python

Caffe should be successfully imported at this step.Now we need to install jupyter without anaconda and only using python2.

  1. Update pip with wget https://bootstrap.pypa.io/pip/2.7/get-pip.py and then use python2 to run the downloaded script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants