Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correctly uninstall numpy on MacOSX?

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 times:

sklearn "numpy.dtype has the wrong size, try recompiling" in both pycharm and terminal

ValueError: numpy.dtype has the wrong size, try recompiling

ImportError in importing from sklearn: cannot import name check_build

So, I try to remediate this error by uninstalling numpy, and reinstalling a previous version.

1) sudo pip install --upgrade numpy..gives permission error

...OSError: [Errno 1] Operation not permitted: '/tmp/pip-OVY0Vq-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'...

2) I tried brew uninstall numpy, but import numpy still works even after a shell restart.

The only thing left I can think of is to manually delete all of the numpy files, which, on a Mac seeem to be found under sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy

....but even that gives me a permission error. what gives?

like image 933
makansij Avatar asked Sep 10 '25 15:09

makansij


1 Answers

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.

like image 133
Zubin Avatar answered Sep 12 '25 04:09

Zubin