pip uninstall#
pip is able to uninstall most installed packages. Known exceptions are:
Pure distutils packages installed with python setup.py install , which leave behind no metadata to determine what files were installed.
Script wrappers installed by python setup.py develop .
Options#
-r , —requirement <file> #
Uninstall all the packages listed in the given requirements file. This option can be used multiple times.
Don’t ask for confirmation of uninstall deletions.
Action if pip is run as a root user. By default, a warning message is shown.
# pip: PyPI Package Manager
pip is the most widely-used package manager for the Python Package Index, installed by default with recent versions of Python.
# Install Packages
To install the latest version of a package named SomePackage :
To install a specific version of a package:
To specify a minimum version to install for a package:
If commands shows permission denied error on Linux/Unix then use sudo with the commands
# Install from requirements files
Each line of the requirements file indicates something to be installed, and like arguments to pip install, Details on the format of the files are here: Requirements File Format
After install the package you can check it using freeze command:
# To list all packages installed using pip
To list installed packages:
To list outdated packages, and show the latest version available:
# Upgrade Packages
will upgrade package SomePackage and all its dependencies. Also, pip automatically removes older version of the package before upgrade.
To upgrade pip itself, do
on Windows machines.
# Uninstall Packages
To uninstall a package:
# Updating all outdated packages on Linux
pip doesn’t current contain a flag to allow a user to update all outdated packages in one shot. However, this can be accomplished by piping commands together in a Linux environment:
This command takes all packages in the local virtualenv and checks if they are outdated. From that list, it gets the package name and then pipes that to a pip install -U command. At the end of this process, all local packages should be updated.
# Updating all outdated packages on Windows
pip doesn’t current contain a flag to allow a user to update all outdated packages in one shot. However, this can be accomplished by piping commands together in a Windows environment:
This command takes all packages in the local virtualenv and checks if they are outdated. From that list, it gets the package name and then pipes that to a pip install -U command. At the end of this process, all local packages should be updated.
# Create a requirements.txt file of all packages on the system
pip assists in creating requirements.txt files by providing the freeze
This will save a list of all packages and their version installed on the system to a file named requirements.txt in the current folder.
# Create a requirements.txt file of packages only in the current virtualenv
pip assists in creating requirements.txt files by providing the freeze
(opens new window) parameter will only output a list of packages and versions that are installed locally to a virtualenv. Global packages will not be listed.
# Using a certain Python version with pip
If you have both Python 3 and Python 2 installed, you can specify which version of Python you would like pip to use. This is useful when packages only support Python 2 or 3 or when you wish to test with both.
If you want to install packages for Python 2, run either:
If you would like to install packages for Python 3, do:
You can also invoke installation of a package to a specific python installation with:
On OS-X/Linux/Unix platforms it is important to be aware of the distinction between the system version of python, (which upgrading make render your system inoperable), and the user version(s) of python. You may, depending on which you are trying to upgrade, need to prefix these commands with sudo and input a password.
Likewise on Windows some python installations, especially those that are a part of another package, can end up installed in system directories — those you will have to upgrade from a command window running in Admin mode — if you find that it looks like you need to do this it is a very good idea to check which python installation you are trying to upgrade with a command such as python -c"import sys;print(sys.path);" or py -3.5 -c"import sys;print(sys.path);" you can also check which pip you are trying to run with pip —version
On Windows, if you have both python 2 and python 3 installed, and on your path and your python 3 is greater than 3.4 then you will probably also have the python launcher py on your system path. You can then do tricks like:
If you are running & maintaining multiple versions of python I would strongly recommend reading up about the python virtualenv or venv virtual enviroments
(opens new window) which allow you to isolate both the version of python and which packages are present.
# Installing packages not yet on pip as wheels
Many, pure python, packages are not yet available on the Python Package Index as wheels but still install fine. However, some packages on Windows give the dreaded vcvarsall.bat not found error.
The problem is that the package that you are trying to install contains a C or C++ extension and is not currently available as a pre-built wheel from the python package index, pypi, and on windows you do not have the tool chain needed to build such items.
The simplest answer is to go to Christoph Gohlke’s
(opens new window) excellent site and locate the appropriate version of the libraries that you need. By appropriate in the package name a -cp**NN******- has to match your version of python, i.e. if you are using windows 32 bit python even on win64 the name must include -win32- and if using the 64 bit python it must include -win_amd64- and then the python version must match, i.e. for Python 34 the filename must include -cp34-, etc. this is basically the magic that pip does for you on the pypi site.
Alternatively, you need to get the appropriate windows development kit for the version of python that you are using, the headers for any library that the package you are trying to build interfaces to, possibly the python headers for the version of python, etc.
Python 2.7 used Visual Studio 2008, Python 3.3 and 3.4 used Visual Studio 2010, and Python 3.5+ uses Visual Studio 2015.
Then you may need to locate the header files, at the matching revision for any libraries that your desired package links to and download those to an appropriate locations.
Finally you can let pip do your build — of course if the package has dependencies that you don’t yet have you may also need to find the header files for them as well.
Alternatives: It is also worth looking out, both on pypi or Christop’s site, for any slightly earlier version of the package that you are looking for that is either pure python or pre-built for your platform and python version and possibly using those, if found, until your package does become available. Likewise if you are using the very latest version of python you may find that it takes the package maintainers a little time to catch up so for projects that really need a specific package you may have to use a slightly older python for the moment. You can also check the packages source site to see if there is a forked version that is available pre-built or as pure python and searching for alternative packages that provide the functionality that you require but are available — one example that springs to mind is the Pillow
(opens new window) , actively maintained, drop in replacement for PIL
(opens new window) currently not updated in 6 years and not available for python 3.
Afterword, I would encourage anybody who is having this problem to go to the bug tracker for the package and add to, or raise if there isn’t one already, a ticket politely requesting that the package maintainers provide a wheel on pypi for your specific combination of platform and python, if this is done then normally things will get better with time, some package maintainers don’t realise that they have missed a given combination that people may be using.
# Note on Installing Pre-Releases
Pip follows the rules of Semantic Versioning
(opens new window) and by default prefers released packages over pre-releases. So if a given package has been released as V0.98 and there is also a release candidate V1.0-rc1 the default behaviour of pip install will be to install V0.98 — if you wish to install the release candidate, you are advised to test in a virtual environment first, you can enable do so with —pip install —pre package-name or —pip install —pre —upgrade package-name. In many cases pre-releases or release candidates may not have wheels built for all platform & version combinations so you are more likely to encounter the issues above.
# Note on Installing Development Versions
You can also use pip to install development versions of packages from github and other locations, since such code is in flux it is very unlikely to have wheels built for it, so any impure packages will require the presence of the build tools, and they may be broken at any time so the user is strongly encouraged to only install such packages in a virtual environment.
Three options exist for such installations:
- Download compressed snapshot, most online version control systems have the option to download a compressed snapshot of the code. This can be downloaded manually and then installed with pip install path/to/downloaded/file note that for most compression formats pip will handle unpacking to a cache area, etc.
- Let pip handle the download & install for you with: pip install URL/of/package/repository — you may also need to use the —trusted-host , —client-cert and/or —proxy flags for this to work correctly, especially in a corporate environment. e.g:
Note the git+ prefix to the URL.
- Clone the repository using git , mercurial or other acceptable tool, preferably a DVCS tool, and use pip install path/to/cloned/repo — this will both process any requires.text file and perform the build and setup steps, you can manually change directory to your cloned repository and run pip install -r requires.txt and then python setup.py install to get the same effect. The big advantages of this approach is that while the initial clone operation may take longer than the snapshot download you can update to the latest with, in the case of git: git pull origin master and if the current version contains errors you can use pip uninstall package-name then use git checkout commands to move back through the repository history to earlier version(s) and re-try.
# Syntax
-
install
- Post author: Gankrin Team
- Post published:
- Get the list of all Python pip package in the requirements.txt file – Note: This OVERWRITES the Existing requirements.txt else will create new one.
- Remove all packages – one by one
- Remove all packages at once –
-
— Install packages
Output installed packages in requirements format
List installed packages
Show information about installed packages
Search PyPI for packages
Build wheels from your requirements
Zip individual packages (deprecated)
Unzip individual packages (deprecated)
Create pybundles (deprecated)
Show help for commands
# Remarks
Sometimes, pip will perfom a manual compilation of native code. On Linux python will automatically choose an available C compiler on your system. Refer to the table below for the required Visual Studio/Visual C++ version on Windows (newer versions will not work.).
PIP Uninstall All Python Packages in Windows – See a Full Guide! [MiniTool Tips]
If you have installed a Python package, you want to uninstall it due to some reason. Then, how to uninstall Python package with PIP? After reading this detailed guide on PIP uninstall given by MiniTool, you know what you should do.
What Is PIP?
Before introducing something on how to uninstall PIP packages, let’s first see a general introduction to Python PIP.
PIP is a package manager in Python that is used to install and manage Python packages. This tool allows you to install and manage Python applications and their dependencies. Package management is very important, so PIP is pre-installed in most Python distributions. By default, Python 3.4 and later & Python 2.7.9 and later (on the Python2 series) include PIP.
If you install a Python package, due to some reason, you may want to uninstall it. Well then, how to uninstall Python package with PIP? Follow the guide here now to know some details.
PIP Uninstall Package – How to Do in Windows
In this part, we show you some commands to uninstall PIP packages, and let’s see them one by one.
PIP Uninstall Packagename
Using this command, you can remove the installed package one by one. This method only works when you have already added Python to the Windows path. If you don’t know how to add it, you can go to press Win + R, type sysdm.cpl and click OK to open System Properties. Go to Advanced > Environment Variables. Under User variables, click New, and edit Variable name and Variable value.
In terms of Variable value, it should include the Python application path and Python Scripts path. To find them, right-click on your Python app (which can be found via the Windows search bar) and choose Open file location. Then, right-click on the Python shortcut and choose Open file location. The app path can be seen like C:\Users\cy\AppData\Local\Programs\Python\Python311. The Scripts path should be C:\Users\cy\AppData\Local\Programs\Python\Python311\Scripts.
![]()
If you get the error “’pip’ is not recognized as an internal or external command”, what should you do? This post gives you some solutions.

Next, see how to uninstall PIP.
Step 1: In Windows, open Command Prompt with admin rights.
![]()
How to open Command Prompt (CMD) in Windows 11? If you are looking for methods to open this tool, read this post and you can find some ways.
Step 2: Type cd\ into the CMD window and press Enter.
Step 3: Type cd followed by the Python Scripts path and here is an example — cd C:\Users\cy\AppData\Local\Programs\Python\Python311\Scripts. Then, press Enter.
Step 4: Execute this command — pip uninstall package_name. Replace the package name with the one you have installed like pandas. See an example pip uninstall pandas.

Step 5: Type y to confirm the uninstallation when asked. Now, your Python package is removed from your computer.
PIP Uninstall All Packages
If you want to delete all the packages installed by PIP, you can use the pip freeze command. It can help you list all the installed packages via PIP and uninstall them without asking for confirmation. The correct type of this command is pip uninstall -y -r <(pip freeze).
If you want, you can save the installed packages in a file called requirements.txt and directly uninstall PIP packages from the file. Run these commands:
pip freeze > requirements.txt
pip uninstall -r requirements.txt This helps to uninstall packages one by one.
pip uninstall -r requirements.txt -y This helps to delete all the packages at once.
In addition to pip freeze, you can also use xargs to uninstall all the PIP packages. The command is pip freeze | xargs pip uninstall -y. If you have packages installed via VCS (like GitLab, Github, Bitbucket, etc.), you need to exclude them and then uninstall Python packages with PIP via this command — pip freeze | grep -v «^-e» | xargs pip uninstall -y.
Final Words
How to uninstall Python package with PIP or how to uninstall PIP packages? After reading this guide on PIP uninstall, try the given ways to easily remove packages from your Windows computer if you need. If you have any ideas, let us know in the comment part.
About The Author
Vera is an editor of the MiniTool Team since 2016 who has more than 5 years’ writing experiences in the field of technical articles. Her articles mainly focus on disk & partition management, PC data recovery, video conversion, as well as PC backup & restore, helping users to solve some errors and issues when using their computers. In her spare times, she likes shopping, playing games and reading some articles.
How To Remove all Python packages installed by pip?
How To Remove all Python packages installed by pip?
This post explains – How To Remove all Python packages installed by pip. To do that lets try the below
Option 1:
Use below command –
Option 2:
If there are any packages which were installed usig VCS, then we will exclude those . And then will remove the packages
Option 3:
Hope This post helps to explain – How To Remove all Python packages installed by pip.