python setup.py uninstall
Note: Avoid using python setup.py install
use pip install .
You need to remove all files manually, and also undo any other stuff that installation did manually.
If you don't know the list of all files, you can reinstall it with the --record
option, and take a look at the list this produces.
To record a list of installed files, you can use:
python setup.py install --record files.txt
Once you want to uninstall you can use xargs to do the removal:
xargs rm -rf < files.txt
Or if you're running Windows, use Powershell:
Get-Content files.txt | ForEach-Object {Remove-Item $_ -Recurse -Force}
Then delete also the containing directory, e.g. /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/my_module-0.1.egg/
on macOS
. It has no files, but Python will still import an empty module:
>>> import my_module
>>> my_module.__file__
None
Once deleted, Python shows:
>>> import my_module
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'my_module'
Calling `pip uninstall` from the source folder where `setup.py install` was called
In the output of the pip show -f pybliometrics
command, we can read:
Files:
Cannot locate RECORD or installed-files.txt
This might explain why it can not be uninstalled. And I am not sure how this happened, nor how to fix it.
But with that said, here are some notes:
The commands shown in your question are inconsistent. On one hand you call
pip show -f pybliometrics
and on the other you callpip3 uninstall pybliometrics
. Butpip
andpip3
are not necessarily the same thing, and do not necessarily interact with the same projects.Do not use
python setup.py install
. Calling thesetup.py
is now deprecated, the recommended way of installing a Python project is via pip.One should never call the
pip
scripts directly, but should always prefer explicitly calling the pip executable module with the targeted Python interpreter (see this reference article and this other answer for details).
So in your case what you probably should have done (no guarantee it would have solved your issue, but it would have minimized risks):
- Clearly identify which Python interpreter you want to use, let's say it is
path/to/bin/pythonX.Y
- Install project with:
path/to/bin/pythonX.Y -m pip install --user path/to/pybliometrics
- Check installed project with
path/to/bin/pythonX.Y -m pip show -f pybliometrics
- Uninstall project with:
path/to/bin/pythonX.Y -m pip uninstall pybliometrics
How to uninstall Python site-package which was installed using python setup.py develop?
I've solved it. Two steps:
Step 1: I install my project 'zeus'
python setup.py install
Setp 2: uninstall it:
pip uninstall zeus
Done
Removing python module installed in develop mode
Use the --uninstall
or -u
option to develop
, i.e:
python setup.py develop --uninstall
This will remove it from easy-install.pth and delete the .egg-link. The only thing it doesn't do is delete scripts (yet).
Python setup.py install - remove previous version while updating
If you want to remove previous versions from your packages then you could use pip in the parent directory of your package. Lets assume your setup.py is in the directory my_package then you can use:
pip install my_package --upgrade
Removing files in setup.py data_files using pip
You can't. python setup.py install
causes your package to be installed using setuptools, not pip, and as a result pip doesn't know enough about the package to be able to uninstall it fully. Not even setuptools can uninstall your package, as there is no python setup.py uninstall
command! If you want pip to be able to uninstall your package correctly, you need to install with pip (pip install .
), but that comes with the drawback that data_files
files will be placed next to the installed package rather than at system root (e.g., myapp.desktop
will end up someplace like ~/.local/lib/python2.7/site-packages/usr/share/applications/myapp.desktop
).
Related Topics
Scatter Plot and Color Mapping in Python
How to Count the Occurrence of a Certain Item in an Ndarray
Finding Median of List in Python
How to Get Rid of "Unnamed: 0" Column in a Pandas Dataframe Read in from CSV File
How to Decode Base64 Data in Python
Typeerror: Cannot Concatenate 'Str' and 'Int' Objects
Generating an Md5 Checksum of a File
Windows Is Not Passing Command Line Arguments to Python Programs Executed from the Shell
How to Export Keras .H5 to Tensorflow .Pb
Tkinter Gui Layout Using Frames and Grid
How to Find the Location of Python Module Sources
How to Sandbox Python in Pure Python
Modifying a List Inside a Function
Basic Http File Downloading and Saving to Disk in Python
How to Forward-Declare a Function to Avoid 'Nameerror's for Functions Defined Later