This document provides some fundamental and comparisons about virtual environment tools. The readers are expected to use one of similar tools once. If not, the readers should read 12. Virtual Environments and Packages — Python 3.12.2 documentation. Some concepts might be oversimplified.
Every beginner tutorial about creating virtual environment starts with venv or virtualenv .
venv is a standard module for creating lightweight environment.
virtualenv is a tool to create isolated environments. Since Python 3.3, a subset of it has been integrated into the standard library under the venv module.
Eventually, the developers build management tools.
virtualenvwrapper is a useful set of scripts for creating and deleting virtual environments.
pyenv is a tool to install, isolate, manage, Python versions per user and per project.
pyenv-virtualenv is a plugin of pyenv to manage virtualenv .
pipenv is a Python virtualenv management tool that supports a multitude of systems and nicely bridges the gaps between pip, python (using system python, pyenv or asdf) and virtualenv.
Black: virtual environment creation tools
Red: virtual environment management tools
Green: Python versions management tools
Here are some of the tool sets that people commonly use.
| virtualenvwrapper | pipenv pyenv | pyenv pyenv-virtualenv | |
|---|---|---|---|
| Manage multiple Python versions | No | Yes | Yes |
| Manage per project | No, you can have many venv per project and many projects per venv | Yes | No, like virtualenvwrapper. |
The readers may ask what conda / mamaba and poetry are all about.
conda is a system-level, binary package and environment manager running on all major operating systems and platforms.
mamba is conda implemented in c++.
Many people might be more familiar with miniconda , micromamba which are minimal CLI versions of aforementioned tools.
Conda is similar to pyenv pyenv-virtualenv but not limited to Python. One can install C++ packages such as Nvidia drivers.
Important use case: people often use this for machine learning projects.
poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. Poetry offers a lockfile to ensure repeatable installs, and can build your project for distribution. Poetry either uses your configured virtualenvs or creates its own to always be isolated from your system.
Python Virtual Environments: A Primer – Real Python
venv — Creation of virtual environments — Python 3.12.2 documentation
virtualenvwrapper 6.0.1.dev12+gb1aa495 — virtualenvwrapper 6.0.1.dev12+gb1aa495 documentation
https://github.com/pyenv/pyenv
https://github.com/pyenv/pyenv-virtualenv
https://github.com/pypa/pipenv
Miniconda — Anaconda documentation
