How to correctly uninstall numpy on MacOSX?
<p>I'm on a Mac, and I installed <code>numpy</code> and <code>sklearn</code> in that order.  Now, I'm faced with these errors that have already been mentioned on SO several times:  </p>

<p><a href="http://stackoverflow.com/questions/38197086/sklearn-numpy-dtype-has-the-wrong-size-try-recompiling-in-both-pycharm-and-te">sklearn &quot;numpy.dtype has the wrong size, try recompiling&quot; in both pycharm and terminal</a></p>

<p><a href="http://stackoverflow.com/questions/17709641/valueerror-numpy-dtype-has-the-wrong-size-try-recompiling/18369312#18369312">ValueError: numpy.dtype has the wrong size, try recompiling</a></p>

<p><a href="http://stackoverflow.com/questions/15274696/importerror-in-importing-from-sklearn-cannot-import-name-check-build">ImportError in importing from sklearn: cannot import name check_build</a></p>

<p>So, I try to remediate this error by uninstalling <code>numpy</code>, and reinstalling a previous version.  </p>

<p>1) <code>sudo pip install --upgrade numpy</code>..gives permission error</p>

<p><code>...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'...</code></p>

<p>2)  I tried <code>brew uninstall numpy</code>, but <code>import numpy</code> still works even after a shell restart.</p>

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

<p>....but even that gives me a permission error.  what gives?  </p>

<p>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).</p>

<p>1)   Installed python at Python.org instead of Mac's stupid version</p>

<p>2)    re-installed all of the modules like <code>numpy</code>, <code>scipy</code>, <code>matplotlib</code>, <code>sklearn</code> and ran this:<code>hash -r python</code> according to this source: <a href="http://stackoverflow.com/questions/34386527/symbol-not-found-pycodecinfo-getincrementaldecoder-trying-to-register-a-packa">Symbol not found: __PyCodecInfo_GetIncrementalDecoder trying to register a package on (Test) PyPi</a>, because it doesn't make python use the cached versions of the modules.</p>

<p>3)   Then, I realized that I had this issue: <a href="https://github.com/scipy/scipy/issues/5093" rel="nofollow">https://github.com/scipy/scipy/issues/5093</a>.  To solve it, I had to make sure I installed the <code>scipy</code> module using <code>python -m pip install scipy='0.15.0'</code> instead of just <code>pip install scipy='0.15.0'</code>, because this solved the issue based on this source: <a href="http://stackoverflow.com/questions/25276329/cant-load-python-modules-installed-via-pip-from-site-packages-directory">Can&#39;t load Python modules installed via pip from site-packages directory</a>.  </p>

<p>So, in conclusion it turns out there really is a big different between what is installed by <code>pip</code>, and what is imported when <code>python</code> 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 <code>python -m pip install &lt;package name&gt;</code>.</p>

python osx python-2.7 numpy