I'm trying to install Biopython (a python package) using PIP on my work machine (OpenSuse x86_64).
It all goes fine until it tries to do some compilation using numpy headers
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c Bio/Cluster/clustermodule.c -o build/temp.linux-x86_64-2.7/Bio/Cluster/clustermodule.o
At which point it fails
Bio/Cluster/clustermodule.c:2:31: fatal error: numpy/arrayobject.h: No such file or directory
This is because numpy/arrayobject.h is in
/usr/local/lib64/python2.7/site-packages/numpy/core/include/
and not
/usr/lib64/python2.7/site-packages/numpy/core/include
Is there a way to update whatever variable is setting the include path (to the /local version), either globally or explicitly for this installation?
UPDATE
Over a year later, I was faced with a similar problem, except this time the .h files simply didn't exist on my system. By just copying the .h from another machine into the
/usr/lib64/python2.7/site-packages/numpy/core/include/numpy
directory installation went fine.
Thanks to @Bort, I discovered this is, apparently a known error (local/user space installation wasn't working anyway).
By editing the Biopython setup.py file in the following places
#Add extensions that requires NumPy to build
if is_Numpy_installed():
import numpy
numpy_include_dir = numpy.get_include()
EXTENSIONS.append(
Extension('Bio.Cluster.cluster',
['Bio/Cluster/clustermodule.c',
'Bio/Cluster/cluster.c'],
include_dirs=[numpy_include_dir],
))
EXTENSIONS.append(
Extension('Bio.KDTree._CKDTree',
["Bio/KDTree/KDTree.c",
"Bio/KDTree/KDTreemodule.c"],
include_dirs=[numpy_include_dir],
))
EXTENSIONS.append(
Extension('Bio.Motif._pwm',
["Bio/Motif/_pwm.c"],
include_dirs=[numpy_include_dir],
))
#Add extensions that requires NumPy to build
if is_Numpy_installed():
import numpy
numpy_include_dir = numpy.get_include()
EXTENSIONS.append(
Extension('Bio.Cluster.cluster',
['Bio/Cluster/clustermodule.c',
'Bio/Cluster/cluster.c'],
include_dirs=[numpy_include_dir, '/usr/local/lib64/python2.7/site-packages/numpy/core/include/'],
))
EXTENSIONS.append(
Extension('Bio.KDTree._CKDTree',
["Bio/KDTree/KDTree.c",
"Bio/KDTree/KDTreemodule.c"],
include_dirs=[numpy_include_dir, '/usr/local/lib64/python2.7/site-packages/numpy/core/include/'],
))
EXTENSIONS.append(
Extension('Bio.Motif._pwm',
["Bio/Motif/_pwm.c"],
include_dirs=[numpy_include_dir, '/usr/local/lib64/python2.7/site-packages/numpy/core/include/'],
))
Then using pip to install from source (I re-compressed the folder with the updated setup.py file in it then ran)
pip install recompressed.tar.gz
and it's installed and good to go.
Update I actually had a very similar problem with this on another openSUSE machine, but this time had no include files anywhere... To get around this I copied them across from the numpy source and fed them in using the include_dirs update above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With