Cannot open include file: 'io.h': No such file or directory Cannot open include file: 'io.h': No such file or directory python python

Cannot open include file: 'io.h': No such file or directory


You need windows 10 SDK,Download visual studio build tools and install

  1. Visual C++ Build tools core features.
  2. MSVC toolset C++ 2019 v142 (x86,x64)
  3. Visual C++ 2019 Redistributable Update
  4. Windows 10 SDK (10.0.17763.0) for Desktop C++

the image from Rivalus


In case anyone finds this thread and is looking for a quicker solution than reinstalling VS and/or Anaconda - I was able to get past this same error by defining the environment variable INCLUDE pointing to the location of io.h - allowing the VS compiler to locate the header.

In my setup, using VS2015, the change to using the Universal CRT means the location of io.h is C:\Program Files (x86)\Windows Kits\10\Include\<version>\ucrt. For different versions/environments the location of io.h may differ.


I stumbled upon the same problem - with very similar configuration to yours (only difference: VS 2015 Pro). After a few weeks on just having to download wheels from other people (e.g. http://www.lfd.uci.edu/~gohlke/pythonlibs/) I finally found a solution which works for me.

There are 2 problems. Problem 1 - you need to use "Developer Command Prompt" - sometimes there is such a program in Start Menu, then you just use it.

(BTW, for others: Python 3.5 needs VS2015, not any other version. Community edition is OK)

If not, you can use the following snippet (in command line):

"%VS140COMNTOOLS%vsvars32.bat"

or even:

where cl >nul 2>nul || "%VS140COMNTOOLS%vsvars32.bat"

(i have it in a batch file to run my build environment)

(If you dont have the %VS140COMNTOOLS% variable, then maybe you just installed the VS and you need e.g. to restart, so that new environment variables become visible).

Now you will get the error:

c:\program files\anaconda3\include\pyconfig.h(68): fatal error C1083: Cannot open include file: 'io.h': No such file or directoryerror: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

(as in your edited answer)

So now run:

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

OK, now you will get the error:

LINK : fatal error LNK1104: cannot open file 'ucrt.lib'error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1104

What now? You need to add library dirs:

set LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64

No errors this time:

> dir05/16/2017  11:33 AM            69,240 hello.c05/16/2017  11:47 AM            15,872 hello.cp35-win_amd64.pyd05/16/2017  11:32 AM                17 hello.pyx(...)

TL;DR - the whole thing:

where cl >nul 2>nul || "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" amd64set INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrtset LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64python setup.py build_ext --inplace