Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Background:

  • I am new to python/Cpp and I am trying to install a python package python-crfsuite which needs to VS to compile.

  • I have installed Anaconda3, pyhon3.6 all in VS2017 community installer (because I think it is better because I will use compiler of VS: cl.exe)

  • I have already run vcvarsall.bat

  • All commands I run are in admin

Process:

When I trying to pip install python-crfsuite, it gives me the error:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -Iinclude "-IC:\Program Files\Anaconda3\include" "-IC:\Program Files\Anaconda3\include" /EHsc /Tppycrfsuite/_pycrfsuite.cpp /Fobuild\temp.win-amd64-3.6\Release\pycrfsuite/_pycrfsuite.obj _pycrfsuite.cpp c:\program files\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\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

  • I have read the answer from here. So I try to replace the path in my system environment as following: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86 => C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86 but it doesnt do anything for me.

  • Then I try to download io.h and place in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include but it is useless.

  • Finally I try to use conda install conda install -c conda-forge python-crfsuite and it is success

Question

  • Why conda install dose not have the problem with io.h, any difference with pip install ?

  • Why there are multiple cl.exe in different path in VS (I am not so familiar with) and are there any difference in using different cl.exe?

I ask these question because even if I installed Anaconda, if I want to use pip install, I have to face these problems and I still cannot figure it out

like image 677
Leoli Avatar asked Jul 10 '17 08:07

Leoli


People also ask

Why can't I find the iOS h file?

To figure out why "io.h" was not found, the terminals output may give hints, i.e. how the including directory are specified. In my case, wrong version of Windows 10 SDK is used: and there's no C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt (but there is C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0 ).

Why is io h not found in terminal output?

To figure out why "io.h" was not found, the terminals output may give hints, i.e. how the including directory are specified. In my case, wrong version of Windows 10 SDK is used:

Where is io h in Visual Studio 2015?

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.


1 Answers

I got the same error but I was installing a package. I solved installing more tools from Visual Studio (I'm using VS 2017 Community and Python 3.6.4). I installed those tools (see installer screenshot here):

  1. Desktop development with C++: I included all defaulted items and the next ones:

    • Windows XP support for C++
    • Support for C++/CLI
    • VC++ 2015.3 v140 toolset
  2. Linux development with C++

Then I opened the Windows PowerShell as Administrator privilegies (Right click to open) and move folder of Visual Studio installation and find that path:

cd [Visual Studio Path]\VC\Auxiliary\Build

Then I executed this file:

.\vcvars32.bat

After that I use pip as normal, for instance, I wanted to install Mayavi:

pip install mayavi

I hope that it helps someone too.

like image 55
Sebastian Cardona Osorio Avatar answered Oct 11 '22 22:10

Sebastian Cardona Osorio