You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled upon a hard to debug issue when using tox to kick of builds that produce native artifacts using setuptools and Microsoft Visual Studio.
setuptools relies on the presence of some environment variables to locate vswhere.exe which is used to find the path to the msvc toolchain. setuptools.msvc uses the following environment variables to build the path to vswhere.exe
ProgramFiles
ProgramFiles(x86)
vswhere.exe in turn itself relies on some environment variables to locate the msvc toolchain. I tried and it looks like it only requires the ProgramData environment variable
TLDR
Without the presence of these three environment variables
ProgramFiles
ProgramFiles(x86)
ProgramData
the discovery of the msvc toolchain fails. It is hard to debug because setuptools doesn't give much diagnostic output.
python run-test: commands[0] | python -c 'import setuptools;print(setuptools.msvc.msvc14_get_vc_env('"'"'amd64'"'"'))'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\stefan\PycharmProjects\tox_msvc_bug\.tox\python\lib\site-packages\setuptools\msvc.py", line 314, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "C:\Users\stefan\PycharmProjects\tox_msvc_bug\.tox\python\lib\site-packages\setuptools\msvc.py", line 269, in _msvc14_get_vc_env
"Unable to find vcvarsall.bat"
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
ERROR: InvocationError for command 'C:\Users\stefan\PycharmProjects\tox_msvc_bug\.tox\python\Scripts\python.EXE' -c 'import setuptools;print(setuptools.msvc.msvc14_get_vc_env('"'"'amd64'"'"'))
Potential Resolution
There are already a couple of environment variables that are passed through by default. I leave it up to discussion whether this usecase warrants adding the mentioned three variables to the default passthrough on windows platforms.
At the very least it would be nice to document that these environment variables need to be passed through in the tox docs, so that it can be found if users run into this issue and to mention keywords such as cython, vcvarsall.
Sadly this is specific to setuptools, and not something we need in general (e.g. for people using flit). As such I think the solution is for setuptools should offer better error.
Description
I stumbled upon a hard to debug issue when using tox to kick of builds that produce native artifacts using setuptools and Microsoft Visual Studio.
setuptools relies on the presence of some environment variables to locate
vswhere.exe
which is used to find the path to the msvc toolchain.setuptools.msvc
uses the following environment variables to build the path tovswhere.exe
ProgramFiles
ProgramFiles(x86)
vswhere.exe
in turn itself relies on some environment variables to locate the msvc toolchain. I tried and it looks like it only requires theProgramData
environment variableTLDR
Without the presence of these three environment variables
ProgramFiles
ProgramFiles(x86)
ProgramData
the discovery of the msvc toolchain fails. It is hard to debug because setuptools doesn't give much diagnostic output.
Steps to reproduce
Create a tox.ini with the following content:
Run
tox
Observe output
Expected behaviour
I expect the tox run to complete sucessfully
Actual behaviour
Run fails with
Potential Resolution
There are already a couple of environment variables that are passed through by default. I leave it up to discussion whether this usecase warrants adding the mentioned three variables to the default passthrough on windows platforms.
At the very least it would be nice to document that these environment variables need to be passed through in the tox docs, so that it can be found if users run into this issue and to mention keywords such as
cython
,vcvarsall
.What do you think?
Additional info
Output of
tox -rvv
: log.txtThe text was updated successfully, but these errors were encountered: