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

make pycaffe gives following error at Ubuntu 14.04 even I installed numpy #1284

Closed
erogol opened this issue Oct 15, 2014 · 16 comments
Closed

Comments

@erogol
Copy link
Contributor

erogol commented Oct 15, 2014

g++ -shared -o python/caffe/_caffe.so python/caffe/_caffe.cpp \
        .build_release/lib/libcaffe.a -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib -lcudart -lcublas -lcurand -lpthread -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_highgui -lopencv_imgproc -lboost_thread -lopenblas -lboost_python -lpython2.7
In file included from python/caffe/_caffe.cpp:12:0:
python/caffe/_caffe.hpp:8:31: fatal error: numpy/arrayobject.h: No such file or directory
 #include <numpy/arrayobject.h>
                               ^
compilation terminated.

this is the error raised as I type make pycaffe. I installed numpy by setup.py.

@mauinz
Copy link

mauinz commented Oct 15, 2014

could you run

ls /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/

this is where the arrayobject.h file should be

@BestSonny
Copy link

could you reinstall numpy?I think that may work.

@moegitree
Copy link

You may need to first relocate the file numpy/arrayobject.h on your computer using "find / -name numpy/arrayobject.h", and then modify the PYTHON_INCLUDE in the Makefile.configure.

Perhaps it's in /usr/local/lib/python2.7 instead of /usr/lib/python2.7

@erogol
Copy link
Contributor Author

erogol commented Oct 19, 2014

after re-install it is resolved . Thanks

@erogol erogol closed this as completed Oct 19, 2014
@mmclkk
Copy link

mmclkk commented Dec 27, 2014

Replicated for Fedora 20. Had the same problem, it appears to be that numpy was in the path /usr/lib64/python2.7/site-packages/numpy so you should change your Makefile.config's Python include path to this. It happens when you install numpy through pip on a x64_86 computer. At least that's the deal for Fedora.

@pranavmaneriker
Copy link

Had the same issue (xubuntu 14.04). I noticed that I had installed numpy with pip install --user and it was in $HOME/.local
Although I fixed by doing a sudo pip install (during reinstall), I think adding a symlink to the local folder would have worked too.

@Franck-Dernoncourt
Copy link
Contributor

I had the same problem on Kubuntu 14.10 Plasma 4. It was also an issue around /usr/local/lib/python2.7 vs. /usr/lib/python2.7. (I had installed NumPy using sudo pip install numpy)

I did sudo apt-get install python-numpy then make clean, make pycaffe, and it seems to have done the trick... symbolic links would have been neater most likely.

(I used sudo find / -name arrayobject.h to find the right location)

@elliottash
Copy link

In OpenSUSE 13.2, this did the trick:

sudo pip uninstall statsmodels
sudo pip uninstall numpy
sudo pip install numpy
sudo pip install statsmodels

@mrgloom
Copy link

mrgloom commented Oct 1, 2015

Same on ubuntu 14.04.

sudo pip uninstall numpy
sudo pip install numpy
make clean
make pycaffe 

not helped.

I have done as Franck-Dernoncourt suggested

sudo apt-get install python-numpy then make clean, make pycaffe

and it solved problem..

@AshishBora
Copy link

I was facing the same problem on OS X El Capitan.

Maybe this is too dumb, but here is what was preventing pycaffe installation from going through:

Although the arrayobject.h file is located in,
/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/

In Makefile, you need to change part of PYTHON_INCLUDE to
/usr/local/lib/python2.7/site-packages/numpy/core/include/

WITHOUT the numpy/

@ahaque
Copy link

ahaque commented Feb 19, 2016

@AshishBora's solution solved the problem for me on Ubuntu 14.04

@admercs
Copy link

admercs commented Jul 29, 2016

I was still having this issue and the fix is simply in the formatting of the ANACONDA_HOME variable (link):

 ANACONDA_HOME := /Users/someone/anaconda
 PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
                 $(ANACONDA_HOME)/include/python2.7 \
                 $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

Really odd.

@BirkhoffLee
Copy link

@AshishBora's solution solved the problem for me on macOS Sierra 10.12.2

@monajalal
Copy link

mona@pascal:~/computer_vision/tf-faster-rcnn/lib$ make
python setup.py build_ext --inplace
running build_ext
skipping 'utils/bbox.c' Cython extension (up-to-date)
building 'utils.cython_bbox' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/utils
{'gcc': ['-Wno-cpp', '-Wno-unused-function']}
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c utils/bbox.c -o build/temp.linux-x86_64-2.7/utils/bbox.o -Wno-cpp -Wno-unused-function
utils/bbox.c:346:31: fatal error: numpy/arrayobject.h: No such file or directory
 #include "numpy/arrayobject.h"
                               ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
make: *** [all] Error 1
mona@pascal:~/computer_vision/tf-faster-rcnn/lib$ ls
build  datasets  layer_utils  Makefile  model  nets  nms  roi_data_layer  setup.py  utils
mona@pascal:~/computer_vision/tf-faster-rcnn/lib$ vi setup.py 
mona@pascal:~/computer_vision/tf-faster-rcnn/lib$ ls /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/
ls: cannot access /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/: No such file or directory
mona@pascal:~/computer_vision/tf-faster-rcnn/lib$ sudo pip install numpy
[sudo] password for mona: 
The directory '/home/mona/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mona/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: numpy in /usr/local/lib/python3.4/dist-packages
mona@pascal:~/computer_vision/tf-faster-rcnn/lib$ sudo -H pip install numpy
Requirement already satisfied: numpy in /usr/local/lib/python3.4/dist-packages

@FarnazJazayeri
Copy link

@mrgloom Thanks ^_^ it worked for me too. I'm with Anaconda3 on Linux Mint.

@xiuliren
Copy link

in Ubuntu 16.04, using apt install python-numpy rather than pip install numpy works.

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