0

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?

2 Answers 2

3

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

1
  • Excellent! this worked for me as well! (bookmarked as "tricks") Jul 11, 2022 at 3:30
0

Disclaimer: the best one I know of... O.K. Try this (based one experience in the past with Ubuntu + this and a little google.)

pip uninstall numpy
pip uninstall spicy
pip install spicy
pip install numpy

and if not, then this:

sudo apt install libatlas-base-dev libatlas3-base libopenblas-base libopenblas-dev

and try the above again.

2
  • I uninstalled them successfully. I used pip install scipy but it didn't work, so I tried with pip install --user scipy and it worked. After pip install numpy it looks like numpy was already installed with scipy. Also, I got some RequestsDependencyWarning but when I try to import numpy and scipy in IDLE's terminal everything works fine. So that worked for me! Sep 8, 2018 at 15:26
  • Good to know! Have a great day!
    – Emily
    Sep 9, 2018 at 22:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .