pip uninstall: “No files were found to uninstall.”

拥有回忆 提交于 2021-02-06 10:12:53

问题


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)

回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/37941523/pip-uninstall-no-files-were-found-to-uninstall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!