Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer virtualenv over venv #392

Open
ghost opened this issue Jun 6, 2021 · 3 comments
Open

Prefer virtualenv over venv #392

ghost opened this issue Jun 6, 2021 · 3 comments

Comments

@ghost
Copy link

ghost commented Jun 6, 2021

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
Copy link
Member

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

# Use `python -m venv` only if there is venv available, virtualenv is not installed, and `-p` not given
if [ -n "${HAS_CONDA}" ]; then
USE_CONDA=1
else
if [ -n "${HAS_M_VENV}" ] && [ -z "${HAS_VIRTUALENV}" ] && [ -z "${VIRTUALENV_PYTHON}" ]; then
USE_M_VENV=1
fi
fi

@native-api
Copy link
Member

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
Copy link

matteosantama commented Jan 4, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants