6

I'm on El Capitan and I want to install numpy with pip. However I get the following error:

Detected a distutils installed project ('numpy') which we cannot uninstall. The metadata provided by distutils does not contain a list of files which have been installed, so pip does not know which files to uninstall.

The existing numpy version seems to be 1.10.4 and the one I try to install is 1.9.2, but I need it. Is there a way to uninstall this version with distutils? Or at least any way to tell pip that there is numpy installed?

riasc
  • 281
  • 2
  • 3
  • 15

4 Answers4

7

Since there is no metadata about the installed files, I found the easiest way to be removing the files manually. Simply retrieve the directory of the module (I referred to this: Retrieving python module path), and delete the folder, as well as the accompanying .egg-info file. Then install your desired numpy version without the --update flag.

Community
  • 1
  • 1
Max
  • 1,313
  • 14
  • 11
2

It might be that your item was installed with anaconda. For your numpy, Try:

conda uninstall numpy

I got the same error, and this fixed it for me.

AnneTheAgile
  • 9,932
  • 6
  • 52
  • 48
0

The "correct" way to this is to create a virtualenv and install the version of NumPy that you want in that.

$ virtualenv pandas
New python executable in /Users/gaius/pandas/bin/python
Installing setuptools, pip, wheel...done.
$ . pandas/bin/activate
(pandas) Dawn-Treader:~ gaius$ pip install pandas
Collecting pandas

If you look at the one you already have:

>>> import numpy
>>> numpy.__file__
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.pyc'

There's no guarantee that that won't be touched by a future OSX patch or upgrade and your changes overwritten, if you do it manually.

Gaius
  • 2,556
  • 1
  • 24
  • 43
-1

It works when I had trouble with uninstall tensorflow of lower version. It should be that if a package is installed by conda, the way to uninstall it through