Compiling numpy for python3 for AIX works, but import fails

Has anyone managed to create a numpy package for AIX6.1 or 7.1?

I downloaded numpy-1.9.2.tar.gz and ran "python3 setup.py install".

After fixing several source files compiles. However, when I try to import numpy, it says:

ImportError: 0509-022 Cannot load module /python3.4/site-packages/numpy/core/multiarray.so. 0509-187 The local-exec model was used for thread-local storage, but the module is not the main program. 0509-193 Examine the .loader section header with the 'dump -Hv' command. 

I guess he has - fPIC problems?!? I tried "CFLAGS =" - fPIC "python3 setup.py install", but with the same result. Any suggestions? Many thanks!

+4
source share
2 answers

I tried again today and it worked. It really was a -fPIC question. I found that "python3 setup.py clean" does not clean all * .so files, so my previous experiments never actually restore them. So here is what you need to do:

(0) download the latest numpy source package and unzip it

(1) Make sure Python.h is first in the following files

 numpy/core/src/multiarray/methods.c numpy/core/src/umath/test_rational.c.src numpy/core/src/umath/operand_flag_test.c.src 

The following do not include Python.h at all and must have compilation for them:

 numpy/core/src/npysort/heapsort.c.src numpy/core/src/npysort/quicksort.c.src numpy/core/src/npysort/mergesort.c.src 

(2)

 export CC="gcc -fPIC" 

(3)

 python3 setup.py build 

(4)

 python3 setup.py install 
+1
source

The python you use must provide this flag. What prints python -c "import sysconfig; print(sysconfig.get_config_vars('CCSHARED'))" ? On a "normal" Linux python, it should print [-fPIC] )

0
source

All Articles