Virtual Environments And Package Management

So far, we stayed inside the core Python ecosystem. We either created our own code or used modules that are distributed with the standard Python distribution. However, there’s an enormous world out there of people using Python for anything you can think of. And many of these people share their code with the world in the form of packages. Let’s call such packages 3rd party packages.

This section of the tutorial introduces you to 3rd party Python packages, virtual environments, the pip package manager, and better alternatives that combine these two, like Pipenv and Poetry.

What is a 3rd party package?

If you followed the tutorial on this site, you already learned about creating your own Python packages. It’s a neat way of organizing our code in a directory structure. Python also allows us to create sharable packages, which can even be distributed to the entire world (for free) through the Python Package Index at

There are close to 400,000 packages on that site as of writing this, and we can install anything we like from the Python package index with one simple command: pip install <package name>.

What is a virtual environment?

A Python venv (short for virtual environment) allows you to keep Python packages in an isolated location from the rest of your system. This is in contrast with the other option, installing them system-wide. Virtual environments have important advantages that we’ll go over first. I’ll show you exactly how to work with virtual environments in the following article.

After that, you need to learn how to install packages inside of a virtual environment, or system-wide. We do this with the pip install command.

Finally, virtual environments and pip come with a default Python installation. However, there are better tools these days. We’ll look at Pipenv, which combines package management and virtual environments into one tool that does some extra things for us as well.

Python Courses

Are you enjoying this free tutorial? Please also have a look at my premium courses. They offer a superior user experience with small, easy-to-digest lessons and topics, progress tracking, quizzes to test your knowledge, and practice sessions. Each course will earn you a downloadable course certificate.

The Python Fundamentals Course For Beginners
Now for $29 (from $49)

Python Fundamentals I is a course for beginners that will get you started with Python in no time. Learn all the essentials, test your progress with quizzes and assignments, and bring it all together with the final course project!

Python Course for Beginners

Modules, Packages, And Virtual Environments
Now for $29 (from $49)

Python Fundamentals II covers creating your own modules and packages, using virtual environments and Python package managers to make your life as a programmer easier. Advance your productivity as a Python programmer!

Python Fundamentals 2

Leave a Comment