Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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) 
like image 886
jeff00seattle Avatar asked Jun 21 '16 10:06

jeff00seattle


People also ask

How do I manually uninstall pip?

To use pip to uninstall a package locally in a virtual environment: Open a command or terminal window (depending on the operating system) cd into the project directory. pip uninstall <packagename>

How do I completely remove pip from Windows?

Run command prompt as administrator. Give the command easy_install -m pip. This may not uninstall pip completely. So again give this command pip uninstall pip If by previous command pip got uninstalled then this command wont run, else it will completely remove pip.

Does pip uninstall remove files?

If all recorded files were successfully removed pip uninstall removes the package directory and the corresponding . dist-info directory (where it stored metadata including the list of files in the package). And that's all.

How do I delete all pip packages?

To remove all packages installed by pip with Python, we run pip uninstall . to run pip freeze to get the list of packages installed. And then we pipe that to xargs pip uninstall -y to remove all the packages listed by pip freeze with pip uninstall . We use the -y to remove everything without needing confirmation.


2 Answers

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

like image 178
OlivierM Avatar answered Oct 01 '22 11:10

OlivierM


This is an old post, but it was top result in Google. The above answers are correct, however, in my case there was still line /usr/local/lib/python3.6/site-packages/easy-install.pth that I had to remove after also removing the egg files.

like image 37
Daniel Blackmon Avatar answered Oct 01 '22 11:10

Daniel Blackmon