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?
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
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
pipenv and installing Python from source into
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)
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.:
- If the new files are binary incompatible with the old ones, other software from the distribution built to link against the originals will segfault or otherwise malfunction.
- If the new version has a different set of files, you’ll end up with a mix of old and new files which may break dependent software as well as the package itself.
- If you change the package with your OS’ package manager later, it will overwrite
pip-installed files, with similarly unpredictable results.
- If there are things like configuration files, differences in them between the versions can also lead to all sorts of breakage.
I had the same error and was able to resolve using the following steps:
pip install --ignore-installed pyOpenSSL
This will install the package with latest version and then if you try to install,
pip install twilio
It will work.
Generally, for similar errors, use this format:
pip install --ignore-installed [package name]==[package version]
I just had this error and the only way I was able to resolve it was by manually deleting the offending directory from
After doing this you may need to reinstall the packages with