Search code examples
pythonpippackage

What globally installed Python Packages should I uninstall?


I have in the past installed Python packages through pip before entering the virtual environment (.venv) by accident, therefore installing them globally. Recently, I believe I've been having conflicts with said globally installed packages and wish to uninstall all the unnecessary ones, as i believe all my projects should install packages in their own virtual environments.

I'm not 100% sure, but believe some packages come with the initial Python installation. My question is, should i uninstall all of them or which ones should I keep, as they are standard to have globally? My current Python version is 3.8.1 and my currently installed global packages are listed below:

  • certifi 2022.5.18.1
  • charset-normalizer 2.0.12
  • click 8.1.3
  • colorama 0.4.6
  • connectorx 0.3.1
  • greenlet 1.1.2
  • idna 3.3
  • importlib-metadata 5.1.0
  • itsdangerous 2.1.2
  • Jinja2 3.1.2
  • MarkupSafe 2.1.1
  • pip 23.0.1
  • pyparsing 3.0.9
  • python-dateutil 2.8.2
  • pytz 2022.7
  • setuptools 41.2.0
  • six 1.16.0
  • SQLAlchemy 1.4.44
  • threadpoolctl 3.1.0
  • urllib3 1.26.14
  • Werkzeug 2.2.2
  • zipp 3.11.0

I have tried searching online, but could not seem to find any information regarding this. In particular, recently, I had a conflict downloading the library cryptography==38.0.3, that got solved by uninstalling a globally cached cffi package.


Solution

  • You can safely remove all packages installed by pip, both system-wide and user-wide. Python does not come with Windows by default, so none of it is essential to the system itself

    You can then simply reinstall Python afterwards to make sure everything is back to normal.

    Unfortunately, pip still doesn't have a convenient to reliably remove all unused dependencies together with a package, which would make such situations much easier to recover from.