pip uninstall: "No files were found to uninstall."

jeff00seattle picture jeff00seattle · Jun 21, 2016 · Viewed 22.6k times · Source

I have created a python module, call it 'foo_bar'.

I can install it and I can upgrade it, but I cannot uninstall it.

I build my module using bdist_wheel:

$ python3 setup.py bdist_wheel

And I install and upgrade it as follows:

$ python3 -m pip --timeout 60 install --upgrade dist/foo_bar-1.4.3-py3-none-any.whl

It is listed within Python 3.4 framework directory:

ls -al /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/
drwxr-xr-x   12 samwise  admin     408 Jun 21 02:50 foo_bar
drwxr-xr-x    9 samwise  admin     306 Jun 21 02:50 foo_bar-1.4.3.dist-info

And it listed within pip freeze:

$ python3 -m pip freeze
foo-bar==1.4.3

However, if I try to perform pip uninstall, it cannot find it's files

$ python3 -m pip uninstall foo-bar
Can't uninstall 'foo-bar'. No files were found to uninstall.

Did I do something wrong within my setup.py for it not to be able to find my modules files during uninstall?

Version info is as follows:

$ python3 --version
Python 3.4.4
$ python3 -m pip --version
pip 8.1.2 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (python 3.4)

Answer

OlivierM picture OlivierM · Mar 7, 2019

I had the same issue. Using verbose helped me to find out a bit more the reason:

$ pip3 uninstall --verbose my-homemade-package
Not sure how to uninstall: my-homemade-package e48e635 - Check: /home/olivier/my-homemade-package
Can't uninstall 'my-homemade-package'. No files were found to uninstall.

Removing everything that was 'my-homemade-package' related in /usr/local/python2.x and /usr/local/python3.x did not help.

I did a pip3 show my-homemade-package and got the location of the installed package on my computer:

$ pip3 show my-homemade-package
Name: my-homemade-package
Version: e48e635
Summary: My Home Made package
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: Proprietary
Location: /home/olivier/my-homemade-package
Requires: pyOpenSSL, pyasn1, protobuf

Removing /home/olivier/my-homemade-package sorted it out the issue (ie: the package was not listed).