In this article, we will be talking about the six most important pip commands that every Python developer should know. Here is what we will be covering in this article:

  • what is pip?
  • pip search
  • pip install
  • pip show
  • pip uninstall
  • pip list
  • pip freeze

What is pip?

PIP is a package manager for Python packages. When we install PIP, it is added to the system as a command line program which can be run from the command line. We not only use PIP to install and uninstall Python packages, it is rather a great tool to create Python virtual environment. And in this article, we will be talking about different useful commands that a Python developer uses in a day to day life.

pip search

Looking for a package, PIP is there to help you out. PIP search allows you to search PyPI for any package using the pip search <package> command. The result of the command returns the name and description of all the matching packages.

Here is an example:

pip search

pip search

pip install

You can install a package using the pip install <package> command. You may already know the package name or you can search for a package using the pip search <package> command. By default a package is installed from PyPI. Given below is a screenshot installing flask:

pip install

pip install

PIP install has several stages:

  • Identify the base requirements. The user supplied arguments are processed here.
  • Resolve dependencies. What will be installed is determined here.
  • Build wheels. All the dependencies that can be, are built into wheels.
  • Install the packages (and uninstall anything being upgraded/replaced).

There is also a concept called caching. PIP provides a cache which functions similarly to that of a web browser and it is on by default. We can disable the cache and always access the PyPI using the –no-cache-dir option as:

As per PyPA documentation:

When making any HTTP request, pip will first check its local cache to determine if it has a suitable response stored for that request which has not expired. If it does then it simply returns that response and doesn’t make the request.

If it has a response stored, but it has expired, then it will attempt to make a conditional request to refresh the cache which will either return an empty response telling pip to simply use the cached item (and refresh the expiration timer) or it will return a whole new response which pip can then store in the cache.

Using PIP, we can also install packages from a requirements file, which we will cover later in the article.

pip show

It’s very common to get details about a package that is currently installed. For any package, this command returns details like name, version, summary, dependent packages and much more. Here is an example:

pip show Jinja2

pip show Jinja2

pip uninstall

This is the simplest one of all. We can remove any package using the pip uninstall <package> command. Here is an example:

pip uninstall

pip uninstall

pip list

This is one of the most important command that every Python developer must know. The pip list command returns the list of packages in the current environment. It also returns the installed version for each package. Packages are listed in a case-insensitive sorted order.

pip list

pip list

PIP list returns a list of all packages. However, for some reason we may also want to list all the packages that are currently outdated. To do so, we can use the pip list -o or pip list --outdated command, which returns a list of packages with the version currently installed and the latest available.

pip list --outdated

pip list –outdated

On the other hand, to list out all the packages that are up to date, we can use the pip list -u or pip list --uptodate command.

pip freeze

We use this command to freeze the packages and their current version. PIP freeze is most useful when we want to use the same set of packages on different platforms or environments. We pass a filename to the pip freeze > filename command. Here is an example:

pip freeze > requirements.txt

pip freeze > requirements.txt

Once we have created the file that holds our packages, we can then use that file to setup another environment with those packages. Here is an example, where we have a virtual environment “venv” and we are now installing the required packages from the requirements.txt file, using the pip install -r <path_to_file> command.

pip install -r requirements.txt

pip install -r requirements.txt

If you are not familiar with Python virtual environment, do checkout my below articles:


This is fairly a small list, however, these are the most used PIP commands for a Python developer in a day to day life. If we want to see other commands or options that are available with pip, just type pip and hit return. This will list all the alternates available.

What commands do you use the most? Don’t forget to share.

Categories: Python


Shu Salmon · November 24, 2018 at 7:21 pm

I’m curious to find out what blog platform you have been utilizing? I’m experiencing some minor security problems with my latest blog and I’d like to find something more secure. Do you have any recommendations?

    Gaurav Gahlot · November 25, 2018 at 9:33 pm

    Hello Salmon! I have build my blog on top of WordPress. It’s pretty simple and easy to customize. I hope that helps.

Mariam Modrak · December 7, 2018 at 4:20 am

Awsome info and straight to the point. I am not sure if this is truly the best place to ask but do you guys have any ideea where to employ some professional writers? Thanks 🙂

    Gaurav Gahlot · December 8, 2018 at 9:07 am

    Hello Mariam! I’m really glad you liked the content. Now, speaking of employing professional writers, I’m sorry, but I know nothing about that. I’m the sole writer for this website.

    Thank you for your kind words!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.