I\'m on a Mac, and I installed numpy
and sklearn
in that order. Now, I\'m faced with these errors that have already been mentioned on SO several t
It worked for me using easy_install to update numpy.
sudo easy_install numpy
I guess you are using MAC OS. I did a workaround to ignore the existing version of numpy (which MAC won't let you uninstall), and install an upgraded version.
Command :
pip install --upgrade --ignore-installed --install-option '--install-data=/usr/local' numpy
Worked fine for me.
To solve this, I did the following: (note that it is not entirely clear to me which of these solved the problem, since I didn't test thoroughly).
1) Installed python at Python.org instead of Mac's stupid version
2) re-installed all of the modules like numpy
, scipy
, matplotlib
, sklearn
and ran this:hash -r python
according to this source: Symbol not found: __PyCodecInfo_GetIncrementalDecoder, because it doesn't make python use the cached versions of the modules.
3) Then, I realized that I had this issue: https://github.com/scipy/scipy/issues/5093. To solve it, I had to make sure I installed the scipy
module using python -m pip install scipy='0.15.0'
instead of just pip install scipy='0.15.0'
, because this solved the issue based on this source: Can't load Python modules installed via pip from site-packages directory.
So, in conclusion it turns out there really is a big different between what is installed by pip
, and what is imported when python
is executed from the terminal. So, to ensure that you are using the pip to install the modules into a particular python, you can use python -m pip install <package name>
.
If you're using the brew version of python
brew uninstall numpy
If you're using the mac version of python:
python 2.7
pip uninstall numpy
python 3
pip3 uninstall numpy
I also getting this when I try to install pandas in MAC, but following command help me to get work around. Following command will ignore any previously installed version. Not sure it really fix issue behind though, but you can also have a try:
sudo pip install numpy --ignore-installed numpy
What works for my Mac OS 10.13.6 (High Sierra):
Just keep uninstalling numpy:
$sudo -H pip uninstall numpy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Uninstalling numpy-1.16.2:
Would remove:
/Library/Python/2.7/site-packages/numpy-1.16.2.dist-info/*
/Library/Python/2.7/site-packages/numpy/*
...
Proceed (y/n)? y
Successfully uninstalled numpy-1.16.2
$sudo -H pip uninstall numpy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Uninstalling numpy-1.14.2:
Would remove:
/Library/Python/2.7/site-packages/numpy-1.14.2.dist-info/*
...
Proceed (y/n)? y
Successfully uninstalled numpy-1.14.2
(re-) Install numpy with option:
$ sudo -H pip install --ignore-installed numpy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting numpy
Downloading https://files.pythonhosted.org/packages/bc/90/3e71b5392bd81d8559917ee38857bb2e4b92c88e87211a68e339127b86f5/numpy-1.16.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (13.9MB)
100% |████████████████████████████████| 13.9MB 921kB/s
Installing collected packages: numpy
Successfully installed numpy-1.16.2