Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

cython

I was trying to compile a simple .pyx file using Cython.

print("hello") 

Here's my setup.py:

from distutils.core import setup from Cython.Build import cythonize  setup(     ext_modules = cythonize("hello.pyx") ) 

Then I run the command.

python setup.py build_ext --inplace 

The error is shown below. I've struggled on googling it but found nothing helpful.

    running build_ext     building 'hello' extension     C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Jackie\AppData\Local\Continuum\Anaconda3\include -IC:\Users\Jackie\AppData\Local\Continuum\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\wdf\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tchello.c /Fobuild\temp.win32-3.5\Release\hello.obj       hello.c     c:\users\jackie\appdata\local\continuum\anaconda3\include\pyconfig.h(68): fatal error C1083: Cannot open include file: 'io.h': No such file or directory       error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2 

Can someone help me to resolve the error, please?

I have Anaconda3 4.1.1, Python 3.5, and Visual Studio Express 2015 installed.

like image 334
user2869934 Avatar asked Oct 13 '16 10:10

user2869934


2 Answers

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

like image 125
bob Avatar answered Sep 17 '22 05:09

bob


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.

like image 41
Calum Atkinson Avatar answered Sep 19 '22 05:09

Calum Atkinson