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

2

6

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

C:\Users\ICAPP02\AppData\Local\Temp\pip-install-0c78okb8\pyodbc_d782ffa5512448c49f83e214e7ec4434\src\pyodbc.h(19): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\cl.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 VisualStudio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\cl.exe

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

Fukuoka answered 29/3, 2021 at 16:23 Comment(0)
E
5

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

Entozoon answered 29/3, 2021 at 16:54 Comment(3)
Ok this is very helpful, do I install the new wheel in the command prompt? I tried pip install wheel but I already had that installed, and building the pyodbc wheel still fails.Fukuoka
pip install pyodbc‑4.0.30‑cp39‑cp39‑win32.whl if the .whl file is in the current working directoryEntozoon
Thank you so much, that was the problem. I was able to install it successfully.Fukuoka
D
0

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/

Diamante answered 23/1, 2023 at 15:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.