3 min read

5 Essential PIP Commands for Python Package Management

Python comes with it's own package manager PIP, if you are a Python developer get used to these 5 pip commands.
5 Essential PIP Commands for Python Package Management

Python's remarkable simplicity and formidable capabilities are made possible through its extensive ecosystem of Python packages. At the heart of this ecosystem is PIP, Python's built-in package manager.

PIP takes the reins of package installation, removal, and updates, seamlessly streamlining your Python development experience. By default, PIP sources packages from the PyPI.org repository, where a wealth of packages awaits your exploration. In this guide, we delve into the world of Python packages and reveal how PIP can be your trusted ally in harnessing their power.

Table fo contents

When diving into Python development, having these five essential commands ready can make your coding journey smoother. Before you start coding, it's smart to check if there are pre-made packages available for what you want to do. Most of the time, you won't need to start from scratch.

pip install

Use the pip install command to effortlessly add packages or libraries from the repository. This command simplifies the process of acquiring and incorporating external Python modules into your development environment.

# pip install <package 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 this option 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

The pip list command offers an informative list of all installed packages and their respective versions within your environment. This versatile command allows you to further refine your list by using handy options such as:

  • -o to identify outdated packages.
  • -u to pinpoint up-to-date packages.
  • -l to focus on local packages.
  • -e to highlight 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

When it comes to removing packages from your environment, pip uninstall is your go-to command. It's efficient and straightforward. Plus, you can take advantage of additional options like:

  • -r you can also remove list of packages defined in a file using -r option
  • -y you 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

Use the pip freeze command to obtain a list of your installed packages in a format suitable for requirements. This convenient command simplifies the process of documenting your project's dependencies in a way that's easily shareable and maintainable.

# 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

The pip show command provides detailed metadata about a package, including its version, description, authorship, licensing information, and more.

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 


In this guide, we've unlocked the potential of five essential PIP commands: install, list,uninstall, freeze and show These commands simplify your Python package management tasks, from installation to documentation.

With these tools, you're ready to navigate Python's package ecosystem confidently and efficiently. Experience the power of PIP, streamline your development process, and embark on your coding journey with newfound ease. Happy coding!