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)
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>
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.
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.
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.
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With