Running Cython in Windows x64 - fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory Running Cython in Windows x64 - fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory windows windows

Running Cython in Windows x64 - fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory


In case anyone is currently (2017) facing same error with visual C++ 2015 tools, launch setup again and also select windows 8.1 / 10 SDK depending upon your OS. This will fix basestd.h error.

If it is still not working, try launching build tools from: C:\Program Files (x86)\Microsoft Visual C++ Build Tools.

Another alternative would be, just install anaconda 2 or 3 (64 bit if also you don't want memory errors). It contains all the important packages prebuilt: sklearn, matplotlib, scipy, numpy, pandas and even web development frameworks such as flask.


I encountered this problem while trying to install pandas in 'develop' mode. I'm up & running now. My environment:

  • Windows XP Pro x64 SP2
  • WinPython 64bit 2.7.5.3 (Python 2.7.5.amd64) <-- "registered" as system's python distro using WinPython Control Panel application

Problems encountered when running python setup.py develop:

  • Unable to find vcvarsall.bat
  • fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory ... exit code 2

Solution:

  1. Download and install Microsoft Visual C++ 2008 Express.
  2. Download and install Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1. You will need only:
    • Developer Tools > Windows Headers and Libraries <-- this gives you basetsd.h
    • Developer Tools > Visual C++ Compilers <-- this gives you the 64-bit compilers
  3. Copy C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.batto C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat. Observe the change in file name.
  4. Add C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin to PATH. This may not be required (I did so before re-installing the SDK w/ Headers & Libs; therefore, the necessity is unknown).

At this point, running python setup.py develop completed successfully and python -c "import pandas; print pandas.__version__" resulted in the git tag I expected.

[EDIT] Further reading:


For those with Windows 10, download the SDK from here to fix the header file basestd.h.

I downloaded the .exe, installed and worked great. SDK was ~2.3GB.

Note: For those like me with 64-bit systems who got an additional error:

`LINK : fatal error LNK1158: cannot run 'rc.exe'    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158

There is a great answer here which solves the problem by placing the rc.exe file in the correct folder for your system.