Skip to content Skip to sidebar Skip to footer

Compiling Numpy For Python3 For Aix Works But Import Fails

Has someone had success building the numpy package for AIX6.1 or 7.1? I downloaded numpy-1.9.2.tar.gz and ran 'python3 setup.py install'. After patching a few source files it compi

Solution 1:

I tried again today and it worked. It was indeed an -fPIC issue. I found that "python3 setup.py clean" doesn't clean up all *.so files and so my previous experiments actually never re-build those. So here's what you need to do:

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

(1) Make sure Python.h is the first include 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 don't have include Python.h at all and need to have for them to compile:

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

Solution 2:

The python you are using should supply that flag. What does python -c "import sysconfig; print(sysconfig.get_config_vars('CCSHARED'))" print? On a "normal" linux python it should print [-fPIC])

Post a Comment for "Compiling Numpy For Python3 For Aix Works But Import Fails"