5 useful PIP commands, you must know!

Python is simple and powerful language, out of which power comes from Python packages.

Python comes with it's own package manager PIP, which handles all things related to install, removal, update of python packages. PIP by-default pulls packages from pypi.org repo you can check available packages on the website.


If you are going for python development you need below 5 commands handy to make your life easier. Before you start writing any functionality you should check if there is any package available for same, most of the time you do not need to reinvent the wheel.

pip install

For installing packages or libraries from the repository:

# pip install <packag name>

# Install django with latest version available
pip install Django

# Install specific version of package
pip install Django==3.2.2
  • -r (--requirement) Install packages from requirements file
# Install packages from requirements.txt
pip install -r requirements.txt
  • -i (--index-url) If you have internal package repo you need to specify it using -i or --index-url option:
# To install from specific Repository
pip install myapp -i https://my-pypi-repo:port/
  • -U (--upgrade) This will upgrade the package to newest available version
# Upgrade Django to newest version
pip install Django -U
pip install Django --upgrade
  • --proxy If you are behind proxy network you can use --proxy to install pip packages:
# Works behind proxy
pip install Django --proxy [user:passwd@]<proxy_server>:<port>
Install Python (PIP) packages without Internet
Python packages on dev environments can be installed from internet but same cannot be the case for production env where internet access is prohibited due to security reasons.

pip list

It will give list of all packages with their versions installed on the environment, you can use different options for listing outdated, up-to-date, local or editable packages:

  • -o list outdated packages
  • -u list up-to-date packages
  • -l list local packages
  • -e list editable packages
# Get list of all Packages
pip list

# Get list of outdated packages
pip list -o

# Get list of uptodate packages
pip list -u

# Get list of editable packages
pip list -e

# Get list of local packages 
pip list -l

pip uninstall

For removing packages from the environment:

  • -r you can also remove list of packages defined in a file using -r option
  • -y fyou can use -y option for bypassing confirmation prompt
# pip uninstall <package_name>
pip uninstall Django

# Remove particular version
pip uninstall Django==3.2.2

# Remove all packages from file
pip uninstall -r requirements.txt

# No-prompt for confirmation
pip uninstall -y Django

pip freeze

Get list of installed packages in requirements format:

# Pass console output to requirements.txt
pip freeze > requirements.txt
  • --all If you want to include all packages like wheel, setuptools, pip use --all option
# List all packages including
pip freeze --all
  • -l (--local) If you do not want to list global packages and only virtualenv packages you can use --local option
# List only local packages on virutal environment
pip freeze -l > requirements.txt

pip show

Show command will show metadata information about the package like version, description, Author, License information, etc.

pip show Django
  • -f (--files) Get list of all installed files with the package
# This will list all files installed as part of the package
pip show -f Django 
Suhas Adhav
In love with web3, DApps and Blockchain Technology | DevOps Expert | Kubernetes | Docker | Jenkins | Cloud | Hadoop
The Internet