caffe icon indicating copy to clipboard operation
caffe copied to clipboard

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

Open erogol opened this issue 12 years ago • 16 comments

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.

erogol avatar Oct 15 '14 10:10 erogol

could you run

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

this is where the arrayobject.h file should be

mauinz avatar Oct 15 '14 14:10 mauinz

could you reinstall numpy?I think that may work.

BestSonny avatar Oct 16 '14 01:10 BestSonny

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

moegitree avatar Oct 16 '14 15:10 moegitree

after re-install it is resolved . Thanks

erogol avatar Oct 19 '14 21:10 erogol

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.

mmclkk avatar Dec 27 '14 02:12 mmclkk

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.

pranavmaneriker avatar Jun 03 '15 11:06 pranavmaneriker

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)

Franck-Dernoncourt avatar Jul 10 '15 16:07 Franck-Dernoncourt

In OpenSUSE 13.2, this did the trick:

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

elliottash avatar Aug 04 '15 18:08 elliottash

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..

mrgloom avatar Oct 01 '15 20:10 mrgloom

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/

AshishBora avatar Dec 13 '15 19:12 AshishBora

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

ahaque avatar Feb 19 '16 15:02 ahaque

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.

admercs avatar Jul 29 '16 16:07 admercs

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

birkhofflee avatar Jan 07 '17 15:01 birkhofflee

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

monajalal avatar Feb 14 '17 01:02 monajalal

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

FarnazJazayeri avatar Nov 09 '17 08:11 FarnazJazayeri

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

xiuliren avatar Nov 14 '17 15:11 xiuliren