1. Home
  2. Training Library
  3. Programming
  4. Programming Courses
  5. Introduction to Third-Party Package Management in Python


Start course

This content is designed to introduce new developers to managing third-party packages using the Python package index and a tool called Pip. This course is part of a series of content designed to help you learn to program with the Python programming language. 

Learning Objectives

  • The Python Package Index
  • The tool used to manage packages called pip
  • The tool used to create isolated Python environments named venv
  • Considerations to be made before installing a third-party package

Intended Audience

This course was designed for new developers wanting to learn Python. 


  • That you’re familiar with the Python runtime
  • That you’re familiar with the Python language syntax
  • This course assumes that you’re not yet familiar with how to install and manage third-party Python software

In this lesson, we’ll review the key takeaways for this course. Throughout this course, we talked about Python package management using the Python Package Index.

We learned that the Python Package Index is a repository of community-created Python software.  By using packages from the package index we can more easily introduce new functionality into our applications. 

We learned the difference between a package from the package index and a Python import package. Python’s import packages are collections of modules with a shared purpose. A package from the index is used as a distribution mechanism. Allowing a collection of Python-related software to be more easily installed. 

We learned that third-party packages include licenses which set the terms for how the package can be used by others. There are many different types of licenses ranging from highly permissive to highly restrictive - and everything in between.

It’s important to consider the licenses applied to a package to ensure that you’re able to abide by the restrictions. We learned that the Python runtime expects third-party packages to reside in the site-packages directory. The exact location of this directory depends on the operating system as well as some other considerations. 

We learned that the tool used for downloading and installing packages is called pip which stands for package installer for Python. Pip installs packages into the site-packages directory which makes the package’s functionality accessible to the runtime. 

We learned that pip can install packages of different versions using the package version specifier syntax. And the uninstall command removes a package. The package version specifier syntax includes mechanisms for specifying a package, optional features, and multiple version constraints. When specifying multiple version constraints, pip requires all of them to be met.

We learned that in order to manage the dependencies of multiple applications we can use the built-in venv module to create an isolated Python environment.

The venv module creates a new directory which matches the Python runtime’s required structure.

To use the version of Python contained in the virtual environment you can call the environment’s version of Python or use the provided scripts to activate the environment. Activating the environment will result in configuration changes to the current shell session. These changes allow us to run Python without having to specify the fill path.

Included in venv’s directory structure is a site-packages directory. This allows us to isolate dependencies for different virtual environments. We learned about a few of pip’s commands. Including the list command which displays all of the third-party packages currently installed into the site-packages directory. 

The install command is used to install a third-party package. It includes a wide range of configuration options which allow us to control different aspects of the installation. In its basic form the install command expects a package version specifier. By omitting any package version details and only specifying the package name the latest version will be installed.

Using the minus r flag of the install command we can specify a requirements file. The requirements file is a text file containing a single package version specifier on each line. The community standard is to name the file requirements.txt. 

This file can be created manually using a text editor or using the pip freeze command to generate a list of package version specifiers for the currently installed packages. We learned that there are considerations that need to be made before installing a package.  

We talked about licensing as a consideration. If you’re going to use third-party code you need to be able to abide by the license’s restrictions. We talked about documentation as another consideration. Good documentation can save hours of effort.

We talked about the effort savings of third-party packages. Introducing third-party packages brings with it educational and maintenance overhead. If that overhead doesn’t offset the value of the package then it might not be worth using.

We talked about quality considerations. If you’re going to rely on third-party code then you want to know that it’s going to perform as expected. We also talked about the security considerations required. The use of third-party code can introduce potential risks. Determining the trustworthiness of third-party packages is a difficult task, albeit an important one. 

The packages on the Python Package Index have the potential to save hours, even hundreds of hours of development effort. Knowing how and when to use them is invaluable. 

Pip includes quite a bit of additional functionality from what we’ve covered in this course. For example, it can install packages from external sources - outside of the package index. There’s a lot of interesting functionality that will help solve specific challenges. 

However, for now, knowing about pip, and venv is going to be enough to get you started. Alright, that's all for this lesson and therefore the course. I hope this has been a useful introduction to Package management in Python.

Thanks so much for watching. And I’ll see you in another course!


About the Author
Learning Paths

Ben Lambert is a software engineer and was previously the lead author for DevOps and Microsoft Azure training content at Cloud Academy. His courses and learning paths covered Cloud Ecosystem technologies such as DC/OS, configuration management tools, and containers. As a software engineer, Ben’s experience includes building highly available web and mobile apps. When he’s not building software, he’s hiking, camping, or creating video games.

Covered Topics