C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

Viewed 14610

I am trying to pack py code with cython, however when I am running python setup.py build_ext --inplace, command prompt shows:

Anaconda3\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

I do have Visual Studio(2017 and 2019) and Build Tools as well; In the command prompt I did:

set LIB=C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
set INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt

before running python setup.py, also tried to run in the VS Studio Administrator: Windowds PowerShell and still the same issue.

And also when I am trying to run %VS140COMNTOOLS%vsvars32.batcommand prompt shows:

ERROR: Cannot determine the location of the VS Common Tools folder.
2 Answers

You probably missing Visual Studion Build Tools (it's an extra command-line toolset you need to install)

https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019

EDIT:

based on a thread found here you should set this:

INCLUDE="C:\Program Files (x86)\Windows Kits0\Include\10.0.19041.0\ucrt"
LIB="C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\um\x86;C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\ucrt\x86"

in command prompt before running python setup.py install, type:

INCLUDE="C:\Program Files (x86)\Windows Kits0\Include\10.0.19041.0\ucrt"
LIB="C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\um\x86;C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\ucrt\x86"

also add these path to your 'edit environment variables for your account' as C:\Program Files (x86)\Windows Kits0\Include\10.0.19041.0\ucrt;C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\um\x86;C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\ucrt\x86

also if you have rights, then add C:\Windows\System32; if you don't have rights(work computer etc), then run python setup.py install in command prompt, NOT anaconda prompt!

Related