简体   繁体   中英

scikit-learn install failure / numpy not found / missing numpy headers

When i try to install scikit-learn on a Suse (openSuse 12.2 x86_64) server via:

pip install -U scikit-learn

i get the following error:

(....)

compile options: '-I/usr/lib64/python2.7/site-packages/numpy/core/include -Isklearn/svm/src/libsvm -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'

gcc: sklearn/svm/libsvm.c

sklearn/svm/libsvm.c:303:31: fatal error: numpy/arrayobject.h: No such file or directory

compilation terminated.

sklearn/svm/libsvm.c:303:31: fatal error: numpy/arrayobject.h: No such file or directory

compilation terminated.

I already tried:

-installing gcc to the latest version
-installing scikit from a downloaded zip, over easy_install (to avoid old repos) -uninstalling and reinstalling numpy (over pip)

When i try to install scipy (which is a requirement of numpy) i get a similar Error:

adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.

adding 'build/src.linux-x86_64-2.7' to include_dirs.

error: file '/usr/lib64/python2.7/site-packages/numpy/f2py/src/fortranobject.c' does not exist

Apparently all the numpy headers in "site-packages/numpy/core/include" are missing. I already reinstalled numpy with pip without any Problems but the headers are still missing.

Ok when i installed numpy with pip or normally all the include header were missing.

To fix this i installed the package "python-numpy-devel" (with zypper, stupid suse package names...) which contains the headers.

After that the headers are there and the rest works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM