Cannot install pyodbc, missing header files, command prompt: fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

Question:

I’m trying to install pyodbc for python 3.9.2 (32-bit), however I keep getting the error:

C:UsersICAPP02AppDataLocalTemppip-install-0c78okb8pyodbc_d782ffa5512448c49f83e214e7ec4434srcpyodbc.h(19): fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory
error: command ‘C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.28.29910binHostX86x86cl.exe’ failed with exit code 2

I understand I am missing the windows.h C++ header files, but I genuinely cant find them, no longer know where to look, know how many I am missing, or know how they look like.

Also when I do locate them, do I place them in the folder that is referenced in the error?: C:Program Files (x86)Microsoft VisualStudio2019CommunityVCToolsMSVC14.28.29910binHostX86x86cl.exe

I added a photo of the Visual Studio package I downloaded, perhaps I downloaded the wrong package…

Asked By: Julian Avila

||

Answers:

For some reason the latest version of pyodbc built a Python 3.9 wheel for 64-bit but not for 32-bit. However, you can get the 32-bit wheel here:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc

Answered By: Gord Thompson

You can also just install the windows sdk, for your particular windows version, to resolve this issue

https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/

Answered By: David
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.