2

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.
doppelherz7
  • 41
  • 1
  • 1
  • 4
  • did you check the path for cl.exe? – flaxon Aug 24 '21 at 20:16
  • yes, so when I am trying to open cl.exe it shows Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x86 Copyright (C) Microsoft Corporation. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ] – doppelherz7 Aug 24 '21 at 20:31

2 Answers2

0

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"
flaxon
  • 928
  • 4
  • 18
  • I have them, It's in my question : C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools – doppelherz7 Aug 24 '21 at 20:18
  • did you check in the path? `C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x86\\cl.exe` – flaxon Aug 24 '21 at 20:19
  • 1
    visual Studio != Build Tools – flaxon Aug 24 '21 at 20:20
  • when you click my link you need to scroll down till you see "Tools for Visual Studio 2019" – flaxon Aug 24 '21 at 20:20
  • it shows that I have MSVC v142 -VS2019 C++ x65/86 build tools(latest) – doppelherz7 Aug 24 '21 at 20:27
  • never mind i did not read your error properly, its says you are missing io.h – flaxon Aug 24 '21 at 20:29
  • see https://stackoverflow.com/a/43998080/12239849 this guy solved it by adding the libs – flaxon Aug 24 '21 at 20:31
  • yes, i added the lib in the command prompt it's still not running, I included it in my question – doppelherz7 Aug 24 '21 at 20:37
  • you need to add 2 paths, one ending with `ucrt\x64` and one with `\um\x64` – flaxon Aug 24 '21 at 20:41
  • Yes, thank ypu, I added it before already, so what solved the issue that I also added System32 to the path and now it works. BUT another poblem appeared : python38.lib(python38.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\link.exe' failed with exit status 1112 – doppelherz7 Aug 24 '21 at 20:54
  • is there a folder? `ucrt\x68` ? in my computer it exists, so lib set to `C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x86` and `C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86` – flaxon Aug 24 '21 at 20:57
0

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!

Camilla
  • 111
  • 10