To venv Or Not To venv

Original question:

Is venv/virtualenv for python 2.x or python 3.x?

…I think that I’ve answered my question while typing this out:

  • venv is for python 3.x and is installed with pip3
  • virtualenv is for python 2.x and is installed with pip
  • DO NOT install virtualenv for python 3.x (pip3)
  • DO NOT install ‘venv’ for python 2.x (pip)
  • pipenv is a dependency manager for virtual environments
  • virtualenvwrapper helps to manage multiple virtual environments


Original post:

Is venv/virtualenv for python 2.x or python 3.x?

I’ve seen it explained as some variant of “[venv is for python 3.x and virtualenv is for python 2.x]”(

But in one example venv is used as the name of the environment initiated with virtualenv (ctrl + f: venv)

and you can [install virtualenv with pip3](more than 2 links not allowed for me atm)

…but you can alias pip as pip3 if you want, or you can take it a step further and register pip3 as pip by updating alternatives (not sharing source as this is a horrible idea)

This had me frozen in place for weeks.

Wrong. You definitively can use virtualenvwith Python 3. I do it all the time :grinning:
Haven’t tried venv for now, but with pipenv I only had a mess. Doesn’t work on my machine properly. Maybe it’s me but I don’t get it to work. With virtualenv everything runs smooth.

I know you can install virtualenv on python 3.x, but why?

pipenv and venv are used for 2 different purposes: pipenv is a package manager for virtual environments and venv is a method of creating virtual environments.

Are you using virtualenv or venv with your virtualenv install on Python 3.x: “Since Python 3.3, a subset of [virtualenv] has been integrated into the standard library under the venv module.”

Issue that I had with virtualenv in python 3.x is that I never knew if I was using it correctly or if venv was a better option.

I use virtualenv because it just works for me (its a bit of a lazy statement but it’s true). I had such a mess with pipenv that I need some more time to make a new approach towards venv :slight_smile:
I like to learn new things but for a tool like a virtual environment I just need something that I can relay on and can efficiently use. Just pick one that works for you.

I’m not knocking your usage of virtualenv - I’m glad virtualenv is working for you!

I know that I posted this yesterday, but I had put a pin in the question awhile ago after someone suggested using Anaconda in place of virtualenv or venv. (“ANOTHER way?!”)

I’m probably overthinking a topic that boils down to user preference/project needs.

You can use both on Python 3 but I believe venv is superseding virtualenv .

virtualenv docs suggest support up to 3.7 at present