caffe2
caffe2 copied to clipboard
install error from source codes with anaconda
I try install the caffe2 from source codes ,so I use the command “conda build conda/cuda && conda install caffe2-cuda --use-local”. However, the error is as follows:
[ 80%] Building CXX object caffe2/CMakeFiles/caffe2_gpu.dir/sgd/iter_op_gpu.cc.o
make[2]: *** No rule to make target '/usr/local/cuda-9.0/lib64/libcudnn.so', needed by 'lib/libcaffe2_gpu.so'。 停止。
make[2]: *** 正在等待未完成的任务....
[ 80%] Building CXX object caffe2/CMakeFiles/caffe2_gpu.dir/sgd/learning_rate_op_gpu.cc.o
CMakeFiles/Makefile2:3195: recipe for target 'caffe2/CMakeFiles/caffe2_gpu.dir/all' failed
make[1]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
File "/home/flyfree/anaconda2/bin/conda-build", line 11, in
Where are your CUDA and CuDNN installations? Can you post the cmake output, which should say where Caffe2 found CUDA and CuDNN during the build process?
@pjh5 I try to install the caffe2 again. but the new error appear is as follows: [ 78%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state.cc.o In file included from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/Python.h:8:0, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/detail/common.h:111, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pytypes.h:12, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/cast.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/attr.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pybind11.h:43, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.h:25, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:32, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.cc:17: /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/pyconfig.h:1190:0: warning: "_POSIX_C_SOURCE" redefined #define _POSIX_C_SOURCE 200112L ^ In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h:39:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:482, from /usr/include/c++/5/utility:68, from /usr/include/c++/5/unordered_map:38, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:19, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.cc:17: /usr/include/features.h:228:0: note: this is the location of the previous definition
define _POSIX_C_SOURCE 200809L
^ In file included from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/Python.h:8:0, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/detail/common.h:111, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pytypes.h:12, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/cast.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/attr.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pybind11.h:43, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.h:25, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:32, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.cc:17: /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/pyconfig.h:1212:0: warning: "_XOPEN_SOURCE" redefined #define _XOPEN_SOURCE 600 ^ In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h:39:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:482, from /usr/include/c++/5/utility:68, from /usr/include/c++/5/unordered_map:38, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:19, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.cc:17: /usr/include/features.h:169:0: note: this is the location of the previous definition
define _XOPEN_SOURCE 700
^
[ 78%] Linking CXX executable ../bin/context_test
[ 78%] Linking CXX executable ../bin/smart_tensor_printer_test
../lib/libcaffe2.so:对‘leveldb::Status::ToStringabi:cxx11 const’未定义的引用
../lib/libcaffe2.so:对‘google::SetUsageMessage(std::__cxx11::basic_string<char, std::char_traits
define _POSIX_C_SOURCE 200809L
^ In file included from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/Python.h:8:0, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/detail/common.h:111, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pytypes.h:12, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/cast.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/attr.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pybind11.h:43, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.h:25, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.cc:17: /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/pyconfig.h:1212:0: warning: "_XOPEN_SOURCE" redefined #define _XOPEN_SOURCE 600 ^ In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h:39:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:482, from /usr/include/c++/5/cstdlib:41, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/core/context.h:20, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.h:19, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.cc:17: /usr/include/features.h:169:0: note: this is the location of the previous definition
define _XOPEN_SOURCE 700
^ In file included from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/Python.h:8:0, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/detail/common.h:111, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pytypes.h:12, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/cast.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/attr.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pybind11.h:43, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.h:25, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:32, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_mkl.cc:23: /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/pyconfig.h:1190:0: warning: "_POSIX_C_SOURCE" redefined #define _POSIX_C_SOURCE 200112L ^ In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h:39:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:482, from /usr/include/c++/5/utility:68, from /usr/include/c++/5/unordered_map:38, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:19, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_mkl.cc:23: /usr/include/features.h:228:0: note: this is the location of the previous definition
define _POSIX_C_SOURCE 200809L
^ In file included from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/Python.h:8:0, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/detail/common.h:111, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pytypes.h:12, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/cast.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/attr.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pybind11.h:43, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.h:25, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:32, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_mkl.cc:23: /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/pyconfig.h:1212:0: warning: "_XOPEN_SOURCE" redefined #define _XOPEN_SOURCE 600 ^ In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h:39:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:482, from /usr/include/c++/5/utility:68, from /usr/include/c++/5/unordered_map:38, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:19, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_mkl.cc:23: /usr/include/features.h:169:0: note: this is the location of the previous definition
define _XOPEN_SOURCE 700
^
[ 79%] Linking CXX executable ../bin/net_gpu_test
../lib/libcaffe2.so:对‘leveldb::Status::ToStringabi:cxx11 const’未定义的引用
../lib/libcaffe2.so:对‘google::SetUsageMessage(std::__cxx11::basic_string<char, std::char_traits
define _POSIX_C_SOURCE 200809L
^ In file included from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/Python.h:8:0, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/detail/common.h:111, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pytypes.h:12, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/cast.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/attr.h:13, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/third_party/pybind11/include/pybind11/pybind11.h:43, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_dlpack.h:25, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:32, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_gpu.cc:24: /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include/python2.7/pyconfig.h:1212:0: warning: "_XOPEN_SOURCE" redefined #define _XOPEN_SOURCE 600 ^ In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h:39:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:482, from /usr/include/c++/5/utility:68, from /usr/include/c++/5/unordered_map:38, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state.h:19, from /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521114404271/work/caffe2/python/pybind_state_gpu.cc:24: /usr/include/features.h:169:0: note: this is the location of the previous definition
define _XOPEN_SOURCE 700
^
cc1plus: warning: unrecognized command line option ‘-Wno-invalid-partial-specialization’
cc1plus: warning: unrecognized command line option ‘-Wno-invalid-partial-specialization’
cc1plus: warning: unrecognized command line option ‘-Wno-invalid-partial-specialization’
cc1plus: warning: unrecognized command line option ‘-Wno-invalid-partial-specialization’
[ 79%] Linking CXX shared module python/caffe2_pybind11_state_gpu.so
[ 79%] Built target caffe2_pybind11_state_gpu
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
File "/home/flyfree/anaconda2/bin/conda-build", line 11, in
The location my cuda had installed is at 'usr/local'
This is now #1980 . Have you pulled the latest code since yesterday? What is gcc --version?
@pjh5 Thanks! I try to uninstall the opencv and protobuf,and install them all with anaconda by the default channel again. The caffe2 works successfully.However,when I try to use detectron,the error appear in the "make ops" pocess,it displays as follows: ImportError: cannot import name caffe2_pb2
What directory are you running the command from that makes that error?
What is LD_LIBRARY_PATH and PYTHONPATH?
Can you run find /home/flyfree/anaconda2 -name libcaffe2.so
@pjh5 I try to use the command 'mkdir -p build && cd build && cmake .. -DCUDA_ARCH_NAME=Kepler && make -j4',finally, the error changes. When I run the 'make ops', it presents as followings: mkdir -p build && cd build && cmake .. && make -j4 -- Caffe2: Found gflags with new-style gflags target. -- Caffe2: Cannot find glog automatically. Using legacy find. -- Caffe2: Found glog (include: /home/flyfree/anaconda2/include, library: /home/flyfree/anaconda2/lib/libglog.so) -- Caffe2: Found protobuf with old-style protobuf targets. -- Caffe2: Protobuf version -- Caffe2: CUDA detected: 9.0 -- Found cuDNN: v7.0.5 (include: /usr/local/cuda-9.0/include, library: /usr/local/cuda-9.0/lib64/libcudnn.so) -- Added CUDA NVCC flags for: sm_30 sm_35 -- CUDA detected: 9.0 -- Added CUDA NVCC flags for: sm_30 sm_35 -- Found libcuda: /usr/local/cuda-9.0/lib64/stubs/libcuda.so -- Found libnvrtc: /usr/local/cuda-9.0/lib64/libnvrtc.so -- Found cuDNN: v7.0.5 (include: /usr/local/cuda-9.0/include, library: /usr/local/cuda-9.0/lib64/libcudnn.so) -- Summary: -- CMake version : 3.5.1 -- CMake command : /usr/bin/cmake -- System name : Linux -- C++ compiler : /usr/bin/c++ -- C++ compiler version : 5.4.0 -- CXX flags : -std=c++11 -O2 -fPIC -Wno-narrowing -- Caffe2 version : 0.8.2 -- Caffe2 include path : /home/flyfree/anaconda2/include -- Have CUDA : TRUE -- CUDA version : 9.0 -- CuDNN version : 7.0.5 -- Configuring done -- Generating done -- Build files have been written to: /home/flyfree/detectron/lib/build make[1]: Entering directory '/home/flyfree/detectron/lib/build' make[2]: Entering directory '/home/flyfree/detectron/lib/build' make[3]: Entering directory '/home/flyfree/detectron/lib/build' make[3]: Entering directory '/home/flyfree/detectron/lib/build' [ 20%] Building NVCC (Device) object CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/ops/caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o nvcc fatal : redefinition of argument 'std' CMake Error at caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o.cmake:203 (message): Error generating /home/flyfree/detectron/lib/build/CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/ops/./caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o
CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/build.make:63: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/ops/caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o' failed make[3]: *** [CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/ops/caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o] Error 1 make[3]: Leaving directory '/home/flyfree/detectron/lib/build' CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/all' failed make[2]: *** [CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/all] Error 2 make[2]: *** 正在等待未完成的任务.... make[3]: Leaving directory '/home/flyfree/detectron/lib/build' [ 60%] Built target caffe2_detectron_custom_ops make[2]: Leaving directory '/home/flyfree/detectron/lib/build' Makefile:127: recipe for target 'all' failed make[1]: *** [all] Error 2 make[1]: Leaving directory '/home/flyfree/detectron/lib/build' Makefile:13: recipe for target 'ops' failed make: *** [ops] Error 2
- the path I run the command 'make ops' is ~/detectron/lib$.
- the information is as follows: export PATH="/home/freefly/anaconda2/bin:$PATH" export PATH="~/anaconda2/bin:$PATH" export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} export LD_LIBRARY_PATH="/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" export PATH="~/anaconda2/conda-bld/caffe2-cuda_1520429019012/work/build:$PATH" export PATH="/home/flyfree/anaconda2/bin:$PATH"
3.After I run the command you said ,the result is as follows: /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521169513805/work/build/lib/libcaffe2.so /home/flyfree/anaconda2/conda-bld/caffe2-cuda_1521177360911/work/build/lib/libcaffe2.so /home/flyfree/anaconda2/pkgs/caffe2-cuda-0.8.dev-py27hae06318_0/lib/libcaffe2.so /home/flyfree/anaconda2/lib/libcaffe2.so
/home/flyfree/anaconda2/bin is the same as ~/anaconda2/bin, so you are adding /home/flyfree/anaconda2/bin to your path three times; it should only be added once.
~/anaconda2/conda-bld/caffe2-cuda_1520429019012/work/build should definitely NOT be in your path. No folder under ~/anaconda2/conda-bld should ever be added to your PATH or LD_LIBRARY_PATH.
Can you run which nvcc and nvcc --version ?
Is this on Ubuntu?