Open lxrswdd opened 1 year ago
Hi @lxrswdd, could you please run in the same machine you are trying to build the package, the following command in a classic windows terminal (cmd
, not powershell) and paste the output here so we can have a look?
cmd /u /c "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 && set
Thank you @abravalheri
I just ranthem in cmd
I also try them in an Anaconda env. It suggests the same thing \Microsoft was unexpected at this time.
That is weird and very difficult to debug without having direct access to the machine 😅. Sorry, I will have to ask you a few more things before being able to help, if that is OK:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat
file exist?pip
):
ProgramFiles(x86)
ProgramFiles
C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
program in your machine (or ...\Microsoft Visual Studio\Installer\vswhere.exe
with ...
replaced by the contents of the ProgramFiles(x86)
or ProgramFiles
environment variables)
vswhere
program, what is the output of the following command (please replace ...
with the correct path, or change directory to the same directory with vswhere
):
"...\vswhere.exe" -latest -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -products *
@abravalheri
2. Sorry, I don't quite get what you meant here. I run the python in an Anaconda virtual env.
Environment variables are a "feature" of the operating system, not directly related to the Python/Anaconda concept of virtual envs (although virtual envs may add/change environment variables when active).
Since in your other comments the folder C:\Program Files (x86)
exists and seem to be the home of vswhere
and vcvarsall
, I am assuming that the value for the ProgramFiles(x86)
environment variable in your system is C:\Program Files (x86)
.
Regarding the attachments you sent, it is OK that the command fails for PowerShell, the syntax I gave you is only valid in the classic windows cmd
[^1].
So... it seems that there is a problem with your installation of vcvarsall.bat
(maybe it got corrupted somehow?)[^2]. Running the following line in a classic windows cmd
prompt should result in a list of environment variables:
cmd /u /c "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 && set
We can break down this line into 2 parts:
...\vcvarsall.bat
I am not sure why the first part is not working. Have you tried uninstalling it and installing it again?
[^1]: You probably need to prepend the command with &
to make it work on PowerShell (as in & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -products *
)
[^2]: Setuptools will always use the latest version you got installed (this is something hardcoded and not something that we can change for now)
It might also be a matter of weird encoding happening on cmd
... Any chance it is breaking when you try to point out the file path C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat
which contains some weird chars (e.g. ` or
(`). In theory this should be fine, specially considering that we have been using quotes...
"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 && set
. I also attached the installation list.
I can see that even if you cd
into the C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build
directory and run vcvarsall.bat x86_amd64
you still get the failure, which rules out the possibility of cmd
messing with the command encoding, and therefore the conclusion is that there is something inside the vcvarsall.bat
script that is not compatible with your system/environment.
I found some people reporting this problem in other contexts:
Please have a look on those. At a first glance, it seems that there is a chance your PATH
environment variable is misconfigured (e.g., invalid chars), which breaks vcvarsall
.
That getting weird, It appears that my PATH environment variable is well configured. There is not any quotation marks.
C:\Users\FunkYou>echo %PATH%
E:\Cuda\bin;E:\Cuda\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;E:\软件\Bandizip\;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.2.0\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;E:\Matlab\bin;C:\Program Files\Pandoc\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\软件\;C:\ProgramData\chocolatey\bin;C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.372-1\bin;C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\FunkYou\AppData\Local\Programs\Eclipse Adoptium\jdk-17.0.7.7-hotspot\bin;E:\Anaconda;E:\Anaconda\Library\mingw-w64\bin;E:\Anaconda\Library\usr\bin;E:\Anaconda\Library\bin;E:\Anaconda\Scripts;C:\Users\FunkYou\AppData\Local\Microsoft\WindowsApps;E:\软件\Microsoft VS Code\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x86;
My user variables
My system variables
I also am not sure what is happening, but I think we manage to track down the root of the problem (from setuptools perspective).
Setuptools needs to run "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
to be able to use Microsoft Visual C++. This process is described by Microsoft's docs at https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170. However that command seems to be failing in your machine, which is making setuptools
think that the installation is not valid (maybe setuptools' error message is not very user friendly and needs improvement, but I believe this is the most likely explanation).
The next best step for you now might be to seek advice from Microsoft on why vcvarsall.bat x86_amd64
is failing and how to fix it[^2]. Once vcvarsall.bat x86_amd64
works, please try to install/run the code in StyleGan2
and let us know if the problem with setuptools still persists[^1].
[^1]: Also if you find a solution to make vcvarsall.bat x86_amd64
work, could you please share it here? It might be beneficial in the future for other devs.
[^2]: It seems that you can set the VSCMD_DEBUG
environment variable to 3
to get more information what is going on on vcvarsall.bat x86_amd64
, maybe that can help to find more details.
Following this link, this error occurs when quotation mark(") exists in your PATH
!
When I run echo %PATH%
on cmd, I found quotation mark in PATH
list.
ex) C:\Users;"C:\Users{user}"; <-- That ' " ' mark is problem
After remove and rewrite path in system variation, this error had been solved
I hope this solution helps you.
setuptools version
setuptools=68.0.0
Python version
Python 3.10.11
OS
Windows 11
Additional environment information
No response
Description
It keeps saying that despite the fact that I have installed MSVC v143 buildtool and Windows 11 SDK.
Expected behavior
I am trying to run a code that was written based on StyleGan2 https://github.com/NVlabs/stylegan3/blob/main/training/networks_stylegan2.py
How to Reproduce
It is really hard to reproduce given the codes involved in multiple codes. Unless download the full package.
Output
The full output of the error can be found here.