I tried to install the Twilio module:
sudo -H pip install twilio
And I got this error:
Installing collected packages: pyOpenSSL Found existing installation: pyOpenSSL 0.13.1 Cannot uninstall 'pyOpenSSL'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Anyone know how to uninstall pyOpenSSL?
Go to anaconda3→Lib→site-packages, find the corresponding old version file, and delete it directly.
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.
This error means that this package's metadata doesn't include a list of files that belong to it. Most probably, you have installed this package via your OS' package manager, so you need to use that rather than pip
to update or remove it, too.
See e.g. Upgrading to pip 10: It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. · Issue #5247 · pypa/pip for one such example where the package was installed with apt
.
Alternatively, depending on your needs, it may be more productive to not use your system Python and/or its global environment but create a private Python installation and/or environment. There are many options here including virtualenv
, venv
, pyenv
, pipenv
and installing Python from source into /usr/local
or $HOME
/$HOME/.local
(or /opt/<whatever>
).
Finally, I must comment on the often-suggested (e.g. at pip 10 and apt: how to avoid "Cannot uninstall X" errors for distutils packages) --ignore-installed
pip
switch.
It may work (potentially for a long enough time for your business needs), but may just as well break things on the system in unpredictable ways. One thing is sure: it makes the system's configuration unsupported and thus unmaintainable -- because you have essentially overwritten files from your distribution with some other arbitrary stuff. E.g.:
pip
-installed files, with similarly unpredictable results.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