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
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
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
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 ).
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:
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 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):
Desktop development with C++: I included all defaulted items and the next ones:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With