wntrblm / nox

Flexible test automation for Python
https://nox.thea.codes
Apache License 2.0
1.29k stars 148 forks source link

nox > Error: python is not installed into the virtualenv, it is located at #416

Closed nss350 closed 3 years ago

nss350 commented 3 years ago

Hi, I'm having a problem trying to get nox to run. I'm on Windows and have a single version of Python installed (3.9.4). I have installed nox globally (python -m pip install nox) and have a project with a noxfile.py.

When I go to run nox (no virtual environment activated or anything), I get the below error. I'm not quite sure where to start here, as I've used nox before on Windows and never encountered this error. Any help would be appreciated.

nox > Running session pytest-3.7 nox > Session pytest-3.7 skipped: Python interpreter 3.7 not found. nox > Running session pytest-3.8 nox > Session pytest-3.8 skipped: Python interpreter 3.8 not found. nox > Running session pytest-3.9 nox > Creating virtual environment (virtualenv) using python.exe in .nox\pytest-3-9 created virtual environment CPython3.9.4.final.0-64 in 435ms creator CPython3Windows(dest=E:\magnetotellurics\code\resistics.nox\pytest-3-9, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\deafw\AppData\Local\pypa\virtualenv) added seed packages: pip==21.0.1, setuptools==54.1.2, wheel==0.36.2 activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

nox > python -m pip install . nox > Error: python is not installed into the virtualenv, it is located at [mypath/to/python.exe]. Pass external=True into run() to explicitly allow this. nox > Session pytest-3.9 failed.

nss350 commented 3 years ago

I have investigated this a bit more and am more confused but have managed to get it running. Here are the things I've found: Platform: Windows Python versions (with nox installed): Tried 3.9.4, 3.9.2, 3.9.1 virtual environment backends: venv and virtualenv Using: powershell

The problem occurred with both virtualenv and venv I always develop using virtual environments and had not experienced any issues before, so I decided to compare some of my working virtual environments to the ones being created by nox. I noticed that the ones being created by nox did not include site-packages in the path (sys.path): ['', 'C:\users\deafw\appdata\local\programs\python\python39\python39.zip', 'C:\users\deafw\appdata\local\programs\python\python39\DLLs', 'C:\users\deafw\appdata\local\programs\python\python39\lib', 'C:\users\deafw\appdata\local\programs\python\python39', 'E:\projects\.nox\tests-work-391'] However, my standard virtual environments do include site packages in the path. I created another virtual environment in the same place I create all my virtual environments and found my path to be this: ['', 'C:\users\deafw\appdata\local\programs\python\python39\python39.zip', 'C:\users\deafw\appdata\local\programs\python\python39\DLLs', 'C:\users\deafw\appdata\local\programs\python\python39\lib', 'C:\users\deafw\appdata\local\programs\python\python39', 'E:\virtualenvs\.nox\tests-work-391', 'E:\virtualenvs\.nox\tests-work-391\lib\site-packages']

Testing with the hypermodern cookie cutter package, nox works fine when the virtualenv site-packages gets added to the path, but fails when it does not. Regardless of whether I am using venv or virtualenv, site-packages gets added to path when I create virtual environments in one folder and not when I create it in a different folder.

This does not appear to be a nox issue. It's either a virtualenv, venv issue or something with my setup that is causing site-packages to not be added to the path in certain locations.

nss350 commented 3 years ago

Closing this issue as I'm pretty sure it's not related to nox but instead to some permissions strangeness happening in Windows that I can't seem to get to the bottom of.