Ubuntu – How to install numpy and scipy for python 2.7.12, Ubuntu 16.04

16.04numpypython-2.7

I tried to install numpy using: pip install numpy

It worked, but I got a warning:
warnings.warn(warning, RequestsDependencyWarning).

Then I tried to install scipy with: python -m pip install --user scipy and it worked. I've checked my packages list with: pip freeze and both of them where on the list: numpy==1.15.1 scipy==1.1.0
But when I tried to import them in my code I got the following error.

ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was:

/home/spyros/.local/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS2_FromObject

I tried to install the numpy again with the same way and the result was the same. Can you please help me solve this?

Best Answer

To install it for python 2.x, this works for me on ubuntu 18.04: sudo apt-get install python-scipy

Related Question