1

Today I tried to compile a file with cython. I downloaded vs_buildtools 2019 and eventually tried installing almost everything within "C++ build tools", still not working. Here are some details.

When I install the default of "C++ build tools" it shows the error that writes in the title. I tried plus installing "CLI support" as an answer given in a similar question, still not working. I also tried add the path of io.h's folder or itself in the sys environment and user environment, still not working.

And if I uninstall it and install version 2017 and Windows 10 SDK it then shows another error "can't find vcvarsall.bat". So I tried to run it as administrator and along with similar files, sad not working. Eventually I tried install almost every thing in the "C++ build tools" except as showing in the picture, yet not solving the problem.

I'm using python 3.7 and I've been using it for a while. Every thing works fine.

Here's the whole error sentence: 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.27.29110\bin\HostX86\x64\cl.exe' failed with exit status 2

enter image description here

  • you probably try to compile c++-code as c. If this not the case, you should provide a [mcve], otherwise it is hard to tell what your problem could be. – ead Sep 10 '20 at 21:29
  • I'm trying to encrypt a .py file and the result I think is supposed to be a .c file and a .pyd file. I use `cythonize -i name.py` to do it. It's hard to give a minimal example of my python file so I tried to create a very simple python file with only a print line to test it. Still showing the "io.h" error. – Abraham Reinhardt Sep 11 '20 at 01:05
  • Ok, it looks as if it cannot find the right windows sdk. You have some of them installed, but maybe it picks up the wrong one. When cythonizing can you see include path to sdk? Which is used? – ead Sep 11 '20 at 05:26
  • I tried the top one and the bottom one on the list (after uninstalling the top one). They all failed to work. I will try some others. thank you for your kind help – Abraham Reinhardt Sep 11 '20 at 05:58
  • https://wiki.python.org/moin/WindowsCompilers says that having an up-to-date version of setuptools is important for the Python build system to detect the compiler – DavidW Sep 11 '20 at 07:08
  • I had seen that note and checked my version, which is 40.8.0, higher than it requires. – Abraham Reinhardt Sep 11 '20 at 07:26
  • @ead I tried all of them still not working. Thank you anyway. I'll give myself a break. See what other things I can do – Abraham Reinhardt Sep 11 '20 at 07:28
  • When I build a cython- module on windows with cythonize, I can see which sdk is picked up, the cl.exe is called with `"-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt"`. You can see what is called in your case: it is either not there or not the right version. A quick fix would be to set right INCLUDE-variable in cmd. But I don't know, why the python doesn't pick it automatically, maybe rebooting after the installation will help python to pick up the right include-path. – ead Sep 11 '20 at 08:35
  • I'll try to include in cmd. But i don't know the detail of it. Is the following line correct? `cythonize -i try.py INCLUDE-C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt` – Abraham Reinhardt Sep 11 '20 at 09:21

1 Answers1

3

Finally I solved it. This is what I installed. enter image description here

I'm sure the reason is that my system was missing Universial Winodows Platform build prerequisites. So it solves the problem. Thank you all for your help.