1. 程式人生 > >caffe安裝:cuda_runtime.h: No such file or directory

caffe安裝:cuda_runtime.h: No such file or directory

Hi guys

need some help!

I have this error when trying to install caffe

CXX src/caffe/parallel.cpp
src/caffe/parallel.cpp:2:26: fatal error: cuda_runtime.h: No such file or directory

include <cuda_runtime.h>

                      ^

compilation terminated.
make: * [.build_release/src/caffe/parallel.o] Error 1

[email protected]:~/caffe1/caffe-master$
[email protected]:~/caffe1/caffe-master$ sudo make all
CXX src/caffe/parallel.cpp
src/caffe/parallel.cpp:2:26: fatal error: cuda_runtime.h: No such file or directory

include <cuda_runtime.h>

                      ^

compilation terminated.
make: * [.build_release/src/caffe/parallel.o] Error 1

Tomas Wood

@odellus

Try cmake. Your cuda is not where the Makefile is looking for it.

juicybatman

@juicybatman

I'm not using cuda! im just using caffe cpu only

i've tried it with cmake but i can't get past the last step where you test caffe with a c++ aplication

Tomas Wood

@odellus

try cmake -DCPU_ONLY=1 ../caffe

Darshan Chaudhary

@darshanime

Hello. I have complied Caffe successfully

But I am facing a problem in compiling pyCaffe

This is my stack :

This message was deleted

This message was deleted

~/caffe$ make pycaffe
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
python/caffe/_caffe.cpp:1:52: fatal error: Python.h: No such file or directory
 #include <Python.h>  // NOLINT(build/include_alpha)
                                                    ^
compilation terminated.
make: *** [python/caffe/_caffe.so] Error 1

Locating the file gives :

~/caffe$ locate Python.h
/home/radar/anaconda/envs/sympy-dev/include/python2.7/Python.h
/home/radar/anaconda/include/python2.7/Python.h
/home/radar/anaconda/pkgs/python-2.7.10-0/include/python2.7/Python.h
/home/radar/anaconda/pkgs/python-2.7.8-1/include/python2.7/Python.h
/home/radar/anaconda/pkgs/python-2.7.9-1/include/python2.7/Python.h
/home/radar/anaconda/pkgs/python-3.4.1-4/include/python3.4m/Python.h
/home/radar/anaconda/pkgs/python-3.4.3-1/include/python3.4m/Python.h
/usr/include/python2.7/Python.h
/usr/include/python3.4m/Python.h
/usr/include/vtk-5.8/vtkPython.h

I think I have to use /home/radar/anaconda/include/python2.7/Python.h

Prasanna S

@IMG-PRCSNG

@darshanime , The problem might be in the python include path of your Makefile.config Recheck it.

Darshan Chaudhary

@darshanime

8月 20 2015 14:54So, I did what you asked :

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /home/radar/anaconda/include/python2.7
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /home/radar/anaconda/include/python2.7

This message was deleted

This 'installed' pycaffe with out any complains.
Here is the stdout :

~/caffe$ make pycaffe
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
touch python/caffe/proto/__init__.py
PROTOC (python) src/caffe/proto/caffe.proto
~/caffe$

Now, when I try to run detect.py, I get this error :

~/caffe/python$ python detect.py 
Traceback (most recent call last):
  File "detect.py", line 24, in <module>
    import caffe
  File "/home/radar/caffe/python/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver
  File "/home/radar/caffe/python/caffe/pycaffe.py", line 14, in <module>
    import caffe.io
  File "/home/radar/caffe/python/caffe/io.py", line 8, in <module>
    from caffe.proto import caffe_pb2
  File "/home/radar/caffe/python/caffe/proto/caffe_pb2.py", line 4, in <module>
    from google.protobuf.internal import enum_type_wrapper
ImportError: No module named google.protobuf.internal

How can I resolve this ?

Darshan Chaudhary

@darshanime

IT'S WORKING !

The simple pip install protobuf was all that was needed.

Prasanna S

@IMG-PRCSNG

@darshaninme , or a sudo apt-get install python-protobuf would too