pyenv / pyenv-virtualenv

a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)
MIT License
6.37k stars 403 forks source link

Prefer virtualenv over venv #392

Open ghost opened 3 years ago

ghost commented 3 years ago

virtualenv includes seed packages (pip, setuptools, wheel) so creating virtualenvs with those already included is much faster than using venv and then installing them with pip. There should at least be an option to prefer virtualenv even if venv is available.

native-api commented 3 years ago

Virtualenv is already preferred if it's installed for the active Python version or if -p is specified: https://github.com/pyenv/pyenv-virtualenv/blob/6742d0ef108450ca607ca9db7007c4a84db06531/bin/pyenv-virtualenv#L158-L165

native-api commented 3 years ago

I guess there could be an option envvar added to prefer Virtualenv even if Venv is present.

That's because the current logic is that there's no need for Virtualenv if Venv can do the job, too -- but as per OP, there may be reasons to prefer Virtualenv regardless.

matteosantama commented 2 years ago

Virtualenv is already preferred if it's installed for the active Python version or if -p is specified

FWIW with pyenv==2.2.3 and pyenv-virtualenv==1.1.5 the -p flag is invalid

EDIT: maybe I'm using it incorrectly?

pyenv virtualenv -p 3.8.12 myvenv