6

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

Leoli
  • 719
  • 1
  • 9
  • 18

2 Answers2

4

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.

  • 1
    Your answer was helpful, but for me only `VC++ 2015.3 v140 toolset` was necessary to build [this library](https://github.com/bcdev/jpy) for example (They probably didn't make it compatible with VS2017 build tools). – Hakim May 08 '18 at 15:57
0

In my case with Windows 10 'io.h' comes with any 'SDK for Windows 10' in visual studio installer (my SDK ver 10.0.20348.0 resolve problem)