0

Python has at least three ways to manage virtual environments:

  1. module venv
  2. virtualenvwrapper
  3. Classic virtualenv

See What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc? and Python venv and virtualenvwrapper combined for discussions of the differences.

Moreover, some (all?) of these can be installed in three ways:

  1. pip
  2. System package manager (e.g. sudo apt-get install virtualenvwrapper)
  3. Directly from source

This leaves up to 9 different virtual environment managers in a single system, each using different folders and scripts.

How do we sort this out? In my system, for example, I see ~/.virtualenv and ~/.virtualenvs, and activate.csh in many places:

/snap/core18/2253/usr/lib/python3.6/venv/scripts/posix/activate.csh
/snap/core18/2284/usr/lib/python3.6/venv/scripts/posix/activate.csh
/snap/core20/1270/usr/lib/python3.8/venv/scripts/posix/activate.csh
/snap/core20/1328/usr/lib/python3.8/venv/scripts/posix/activate.csh
/snap/gnome-3-34-1804/72/usr/lib/python3.6/venv/scripts/posix/activate.csh
/snap/gnome-3-34-1804/77/usr/lib/python3.6/venv/scripts/posix/activate.csh
/usr/lib/python3.9/venv/scripts/posix/activate.csh

In addition, some projects can have their own virtual envs in the project folder.

How do we sort out which folder is managed by which virtualenv manager? Is there a way to consolidate all the different managers? In 2022, what's a clean, consolidated way to manage virtual environments: Do we still need virtualenvwrapper, and if so, which installation path and how do we consolidate to it?

SRobertJames
  • 8,210
  • 14
  • 60
  • 107

0 Answers0