nox
nox copied to clipboard
Ubuntu VirtualEnv Creation can be configured to place python at bin/local/python, causes nox failure to find pip
A user reported seeing this error to me. To be clear, the issue isn't in nox but instead in debian/virtualenv, but I wanted to open this so others that encounter this with nox can find the breadcrumbs.
TL;DR - you can set DEB_PYTHON_INSTALL_LAYOUT
and revert to the previous way and you should be unblocked.
Error: python is not installed into the virtualenv, it is located at /usr/bin/python. Pass external=True into run() to explicitly allow this.
We spent some time digging, comparing configurations. Ultimately I requested they run virtualenv outside of nox.
https://askubuntu.com/questions/1406304/virtualenv-installs-envs-into-local-bin-instead-of-bin
This var, DEB_PYTHON_INSTALL_LAYOUT
can be set and will allow virtualenv and nox to run as expected
export DEB_PYTHON_INSTALL_LAYOUT='deb'
Expected Behavior
Expect nox to create a virtualenv and successfully find pip, python, etc.
Environment
- OS: Linux (Debian Rodete)
- Python: 3.10.5
- Nox: 2022.1.7
- VirtualEnv:20.16.3
I think https://github.com/pypa/virtualenv/issues/2350 is related to this.
Running sysconfig you can detect the issue
Fails
❯ python3.10 -m sysconfig
Platform: "linux-x86_64" Python version: "3.10" Current installation scheme: "posix_local"
Works
❯ python3.10 -m sysconfig
Platform: "linux-x86_64" Python version: "3.10" Current installation scheme: "posix_prefix"