Pyconfig.h - Cannot open include file: 'io.h': No such file or directory
Reference Information:
-
I am new to python / Cpp and I am trying to install the python package python-crfsuite which needs to compile VS.
-
I installed Anaconda3, pyhon3.6 all community installer VS2017 (because I think it's better because I'll use the compiler the VS:
cl.exe
) -
I already ran
vcvarsall.bat
-
All the commands I run are in admin
Process:
When I try pip install
python-crfsuite it gives me an 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 read the answer here . So I am trying to replace the path in my system environment like this:
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 does nothing for me. -
Then I try to load
io.h
and put inC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include
, but it's no use. -
Finally I am trying to use conda install
conda install -c conda-forge python-crfsuite
and this is success
Question
-
Why
conda install
doesn't the dose have a problem withio.h
, any difference withpip install
? -
Why are there multiple
cl.exe
in different paths in VS (I'm not that familiar) and is there any difference in using differentcl.exe
?
I am asking this question because even if I have installed Anaconda if I want to use pip install I have to face these problems and I still cannot figure it out
source to share
I got the same error but I was installing the package. I decided to install more tools from Visual Studio (I am using VS 2017 Community and Python 3.6.4). I installed these tools (see installer snapshot here ):
-
Desktop Development with C ++: I have included all the default elements and the following:
- Windows XP support for C ++
- C ++ / CLI support
- VC ++ 2015.3 v140 toolset
-
Linux development with C ++
Then I opened Windows PowerShell as administrator privileges (right click to open) and navigate to the Visual Studio installation folder and find this path:
cd [Visual Studio Path]\VC\Auxiliary\Build
Then I executed this file:
.\vcvars32.bat
After that I use pip as usual, for example, I wanted to install Mayavi:
pip install mayavi
I hope this helps someone too.
source to share