Skip to content Skip to sidebar Skip to footer

How Does One Install/fix A Failed Numpy Installation That Works On Python 3.4 But Not In 3.5?

I was trying to use numpy in ubuntu but it fails with error: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of nump

Solution 1:

You cannot mix and match between Python versions. Every version needs its own copy of NumPy. This is because Python does not provide a cross-version binary compatibility. For pure Python packages (that have no compiled code, as it is the case for NumPy), it could work in principle but the environment is hard to manage. Some distributions share the .py files with symlinks.

The first thing is to remove the wrong install. I will focus only on getting the python 3.5 install to work

cd /usr/local/lib/python3.5/dist-packages

Warning before continuing using the rm command should be done with caution, even more so as you need root privilege to operate in /usr.

rm -r numpy

(as root).

Then, you need pip. You can install it with a file from the pypi webpages: https://pip.pypa.io/en/latest/installing/

cd
wget https://bootstrap.pypa.io/get-pip.py

and install with

python3.5 get-pip.py

You can do this for the whole computer or just the current user (with the --user option). Once pip is installed,

python3.5 -m pip install -U numpy

should do.

If there is no binary package for you version of Python and pip starts to compile things and fails to do do, install the package python3.5-dev.


Post a Comment for "How Does One Install/fix A Failed Numpy Installation That Works On Python 3.4 But Not In 3.5?"