-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
py3 venv creation fails when a virtualenv is active #1095
Comments
It turns out that (outer) [vagrant@vagrant-arch ~]$ deactivate
[vagrant@vagrant-arch ~]$ source virtualenv/bin/activate
(virtualenv) [vagrant@vagrant-arch ~]$ python -m pip install tox Is the active venv, should contain tox (virtualenv) [vagrant@vagrant-arch ~]$ ls virtualenv/lib/python3.6/site-packages/
(virtualenv) [vagrant@vagrant-arch ~]$ ls virtualenv/bin/
activate activate.csh activate.fish python python3 But tox is installed to to the original virtualenv (virtualenv) [vagrant@vagrant-arch ~]$ ls outer/lib/python3.6/site-packages/
__pycache__ pip pkg_resources pluggy-0.5.2.dist-info py-1.4.34.dist-info setuptools-36.6.0.dist-info six.py tox-2.9.1.dist-info virtualenv.py wheel
easy_install.py pip-9.0.1.dist-info pluggy py setuptools six-1.11.0.dist-info tox virtualenv-15.1.0.dist-info virtualenv_support wheel-0.30.0.dist-info
(virtualenv) [vagrant@vagrant-arch ~]$ ls outer/bin
activate activate.csh activate.fish activate_this.py easy_install easy_install-3.6 pip pip3 pip3.6 python python-config python3 python3.6 tox tox-quickstart virtualenv wheel I've tried creating a similar venv with the |
Hitting this here as well: pre-commit/pre-commit#755 I suspect a fix is needed from the |
This appears to be the bpo issue: https://bugs.python.org/issue30811 |
It's not clear to me who should be responsible for the fix. Should Regardless, here's the workaround that I currently have in tox-venv: The executable path detection could be improved, as it currently just looks for |
I opted for a similar workaround: https://github.com/pre-commit/pre-commit/blob/805a2921ad0d34698433972c6fcb1a6dca47191d/pre_commit/languages/python_venv.py#L13-L39 (main difference is pre-commit already does some normalization so I use |
Eh, yeah overall I feel like we should be venv compatible. |
@gaborbernat According to pew-org/pew#173, that doesn't seem to be the case. @uranusjr Care to chime in? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions. |
@gaborbernat I think the issue should be renamed to “running venv inside virtualenv” to differentiate it from #1339. |
@FranklinYu is the updated title sufficient? |
This is becoming obsolete with #1366 now in full swing. |
If a user attempts to create a python 3 "venv" while working under an active "virtualenv", the resulting virtual environment will not be properly created.
As you can see below, the
venv
andvirtualenv
environments are both created with python 3's "venv" module. However, the latter was created under an activeouter
virtualenv, and is missing a number of binaries as well as the contents of its site-packages directory.python -m pip
does function though.Setup:
bin
contents:site-packages
contents:The text was updated successfully, but these errors were encountered: