Use python -m venv
jobevers opened this issue · comments
For python3, virtualenvs should be created using python -m venv
https://docs.python.org/3/library/venv.html#creating-virtual-environments
But in
Line 46 in b7680c4
the command is set to use
virtualenv
. It would be nice to detect if there is a venv module available and use that instead of the virtualenv
commandTo add to this, something isn't right here...
$ python3 -m venv $WORKON_HOME/venv-vs-vex
$ vex venv-vs-vex
Error: path '$WORKON_HOME/venv-vs-vex' did not look like a virtualenv
They should be 100% compatible.
@brianbruggeman it works for me if I use -m virtualenv
:
rsyring@loftey:~$ python3 -m virtualenv $WORKON_HOME/venv-vs-vex
Using base prefix '/usr'
New python executable in /data/tmp/virtualenvs/venv-vs-vex/bin/python3
Also creating executable in /data/tmp/virtualenvs/venv-vs-vex/bin/python
Installing setuptools, pip, wheel...done.
rsyring@loftey:~$ vex venv-vs-vex
(venv-vs-vex)rsyring@loftey:~$
@rsyring venv is now part of the standard library in python3. While I accept that there is a work-around, I think that vex should work with the standard library version.
"virtualenvs should be created using python -m venv"
Why "should"?
Do not just phrase your desires as "should." Explain the actual justification.
At this point, I've left vex
and created my own tool that does what I want it to do because it's really obvious we disagree on direction and I am not going to waste my time arguing with someone that's not interested in new ideas.
@brianbruggeman you have nothing to do with this issue, please don't post on my issues irrelevantly to advertise your projects
Can I give it a go, as I'm currently interested in this too (I know it's been closed, but I can see it hasn't been closed by the author)
In an otherwise empty virtualenv, venv more or less halves the space consumed by virtualenv (after adding wheel
too, as virtualenv does). Also, it takes less time to install a virtualenv with venv than with virtualenv (without adding wheel
this time, as I don't know how to time that in Windows). This is because venv only copies some scripts, creates an empty lib/site-packages directory and creates a cfg file pointing to the main python, enabling the use of the main stdlib without copying it over. So, less time to create and less space per virtualenv (~10 MiB).
Problem: I don't know how venv has changed from Python 3.3 to 3.7, or how the pyvenv module worked before being deprecated and droped.
Note: The second comment is incorrect now. If I do vex test-venv cmd
after py -3 venv
it works just fine.