10

I tried to install netifaces in Python 3.6.2 by:

pip install netifaces

but when I run it in cmd, I get this error:

c:\users\seyed_vahid\appdata\local\programs\python\python36\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 14.0\VC\bin\cl.exe' failed with exit status 2

How can I fix it?

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
naghi
  • 253
  • 3
  • 8
  • 15
  • Did you try running the command in a Developer Command Prompt window? The paths to VS include files aren't set in a regular command window. On Windows 10, just type "developer command prompt" in the search control on the taskbar, and the shortcut should be the top result. – Colin Robertson Aug 30 '17 at 20:39
  • I running the command in a Developer Command Prompt window,but again get top error – naghi Aug 31 '17 at 02:30
  • I don't think it's possible not to install the UCRT when you check Visual C++ in the Features list in VS2015 setup, but I could be mistaken. In your Developer Command Prompt for VS2015 window, do a SET command. Does the INCLUDE path have C:\Program Files (x86)\Windows Kits\10\include\10.0.[version].0\ucrt in it somewhere? If not, then rerun setup (go to Apps in Control Panel, select VS 2015, choose Change) and in Features, in Windows and Web Development, under Universal Windows App Development Tools, check the latest Windows 10 SDK. Update, reboot, retry. – Colin Robertson Sep 01 '17 at 00:18
  • 1
    On the other hand, if the ucrt directory IS in the INCLUDE path, then you could try to run the Developer Command Prompt as an administrator. Open the Visual Studio 2015 folder in the Start menu, right-click the Developer Command Prompt for VS2015 shortcut, then choose More > Run as administrator. This seems unlikely to be the solution, since I wouldn't expect the pip install command to find cl.exe if it was a problem, but it probably won't hurt to try. – Colin Robertson Sep 01 '17 at 00:35

2 Answers2

3

Try open VS Installer and install something like

VC++ 2015 v140 toolset

jerryc05
  • 454
  • 1
  • 4
  • 16
2

I just had a frustrating day trying to find a way to make this work as well. (I use the Visual Studio, Python, Windows combination).

When getting build errors during pip installs (io.h, rc.exe not found etc), in my case with netifaces / pychromecast (but the issue is the same for all), make the following changes / additions to your environment variables:

INCLUDE (create if needed)

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\SDK\ScopeCppSDK\SDK\include\ucrt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\SDK\ScopeCppSDK\SDK\include\shared;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\SDK\ScopeCppSDK\SDK\include\um

LIB (create if needed)

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\SDK\ScopeCppSDK\SDK\lib

Add to PATH

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\SDK\ScopeCppSDK\SDK\bin

After making these changes I was able to install / compile things properly

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
Jeroen Ritmeijer
  • 2,772
  • 3
  • 24
  • 31