Python 3.13 - Failed Installing pyodbc

I installed Python 3.13.0 yesterday on a Windows Server and then got a bunch of errors when pip installing pyodbc. All other packages were successfully installed though. Did not have this issue with the previous Python version 3.12.3. Please help. Thank you.

C:\Windows\system32>pip install pyodbc
Collecting pyodbc
Using cached pyodbc-5.1.0.tar.gz (115 kB)
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing metadata (pyproject.toml) … done
Building wheels for collected packages: pyodbc
Building wheel for pyodbc (pyproject.toml) … error
error: subprocess-exited-with-error

× Building wheel for pyodbc (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [99 lines of output]
WARNING: ‘’ not a valid package name; please use only .-separated package names in setup.py
running bdist_wheel
running build
running build_py
creating build\lib.win-amd64-cpython-313
copying src\pyodbc.pyi → build\lib.win-amd64-cpython-313
running build_ext
building ‘pyodbc’ extension
creating build\temp.win-amd64-cpython-313\Release\src
“C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe” /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 “-ID:\Program Files\Python313\include” “-ID:\Program Files\Python313\Include” “-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt” /EHsc /Tpsrc\cnxninfo.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\cnxninfo.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
cnxninfo.cpp
D:\Program Files\Python313\include\cpython/unicodeobject.h(343): warning C4365: ‘=’: conversion from ‘unsigned int’ to ‘int’, signed/unsigned mismatch
D:\Program Files\Python313\include\cpython/unicodeobject.h(367): warning C4365: ‘=’: conversion from ‘unsigned int’ to ‘int’, signed/unsigned mismatch
D:\Program Files\Python313\include\cpython/longintrepr.h(135): warning C4365: ‘=’: conversion from ‘uintptr_t’ to ‘Py_ssize_t’, signed/unsigned mismatch
D:\Program Files\Python313\include\cpython/ceval.h(21): warning C5039: ‘PyUnstable_Eval_RequestCodeExtraIndex’: pointer or reference to potentially throwing function passed to ‘extern “C”’ function under -EHc. Undefined behavior may occur if this function throws an exception.
D:\Program Files\Python313\include\cpython/abstract.h(35): warning C4365: ‘return’: conversion from ‘size_t’ to ‘Py_ssize_t’, signed/unsigned mismatch
“C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe” /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 “-ID:\Program Files\Python313\include” “-ID:\Program Files\Python313\Include” “-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt” /EHsc /Tpsrc\connection.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\connection.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
connection.cpp
D:\Program Files\Python313\include\cpython/unicodeobject.h(343): warning C4365: ‘=’: conversion from ‘unsigned int’ to ‘int’, signed/unsigned mismatch
D:\Program Files\Python313\include\cpython/unicodeobject.h(367): warning C4365: ‘=’: conversion from ‘unsigned int’ to ‘int’, signed/unsigned mismatch
D:\Program Files\Python313\include\cpython/longintrepr.h(135): warning C4365: ‘=’: conversion from ‘uintptr_t’ to ‘Py_ssize_t’, signed/unsigned mismatch
D:\Program Files\Python313\include\cpython/ceval.h(21): warning C5039: ‘PyUnstable_Eval_RequestCodeExtraIndex’: pointer or reference to potentially throwing function passed to ‘extern “C”’ function under -EHc. Undefined behavior may occur if this function throws an exception.
D:\Program Files\Python313\include\cpython/abstract.h(35): warning C4365: ‘return’: conversion from ‘size_t’ to ‘Py_ssize_t’, signed/unsigned mismatch
src\connection.cpp(114): warning C4312: ‘type cast’: conversion from ‘unsigned long’ to ‘SQLPOINTER’ of greater size
src\connection.cpp(118): warning C4312: ‘type cast’: conversion from ‘long’ to ‘SQLPOINTER’ of greater size

pyodbc appears (Commits · mkleehammer/pyodbc · GitHub) to be preparing to release Python 3.13 wheels. I would probably just wait on that.

The specific error you have though seems to have been resolved in PyToCType uses internal function removed from Python 3.13 · Issue #1344 · mkleehammer/pyodbc · GitHub, so you could probably also pip install git+https://github.com/mkleehammer/pyodbc.

2 Likes

Minor note, it’s much better to copy/paste the text of the error (which you did do in part) because we can’t Ctrl-F or select/copy a screenshot. Also, this and other forums like StackOverflow and Reddit often let you ecnlose code/output in triple backticks or highlight text and click the </> button to format it as code, which really helps readability. I know it’s not intuitive, but steps like these really help your helpers help you.

I can confirm the same error appears for me when installing pyodbc on Windows for Python 3.13:

(.venv) C:\Users\Al\Desktop\delme5>pip install pyodbc
Collecting pyodbc
  Downloading pyodbc-5.1.0.tar.gz (115 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyodbc (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [108 lines of output]
      WARNING: '' not a valid package name; please use only .-separated package names in setup.py
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win-amd64-cpython-313
      copying src\pyodbc.pyi -> build\lib.win-amd64-cpython-313
      running build_ext
      building 'pyodbc' extension
      creating build\temp.win-amd64-cpython-313\Release\src
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 -IC:\Users\Al\Desktop\delme5\.venv\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\cnxninfo.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\cnxninfo.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      cnxninfo.cpp
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(343): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(367): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longintrepr.h(135): warning C4365: '=': conversion from 'uintptr_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/ceval.h(21): warning C5039: 'PyUnstable_Eval_RequestCodeExtraIndex': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/abstract.h(35): warning C4365: 'return': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Temp\pip-install-zxwsemfx\pyodbc_7d6499e66e99423bb1ee4ca921ef55ae\src\wrapper.h(69): warning C5266: 'const' qualifier on return type has no effect
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 -IC:\Users\Al\Desktop\delme5\.venv\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\connection.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\connection.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      connection.cpp
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(343): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(367): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longintrepr.h(135): warning C4365: '=': conversion from 'uintptr_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/ceval.h(21): warning C5039: 'PyUnstable_Eval_RequestCodeExtraIndex': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/abstract.h(35): warning C4365: 'return': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Temp\pip-install-zxwsemfx\pyodbc_7d6499e66e99423bb1ee4ca921ef55ae\src\wrapper.h(69): warning C5266: 'const' qualifier on return type has no effect
      src\connection.cpp(114): warning C4312: 'type cast': conversion from 'unsigned long' to 'SQLPOINTER' of greater size
      src\connection.cpp(118): warning C4312: 'type cast': conversion from 'long' to 'SQLPOINTER' of greater size
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 -IC:\Users\Al\Desktop\delme5\.venv\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\cursor.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\cursor.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      cursor.cpp
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(343): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(367): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longintrepr.h(135): warning C4365: '=': conversion from 'uintptr_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/ceval.h(21): warning C5039: 'PyUnstable_Eval_RequestCodeExtraIndex': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/abstract.h(35): warning C4365: 'return': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Temp\pip-install-zxwsemfx\pyodbc_7d6499e66e99423bb1ee4ca921ef55ae\src\wrapper.h(69): warning C5266: 'const' qualifier on return type has no effect
      src\cursor.cpp(646): warning C4365: 'argument': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      src\cursor.cpp(652): warning C4365: 'argument': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 -IC:\Users\Al\Desktop\delme5\.venv\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\decimal.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\decimal.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      decimal.cpp
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(343): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(367): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longintrepr.h(135): warning C4365: '=': conversion from 'uintptr_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/ceval.h(21): warning C5039: 'PyUnstable_Eval_RequestCodeExtraIndex': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/abstract.h(35): warning C4365: 'return': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Temp\pip-install-zxwsemfx\pyodbc_7d6499e66e99423bb1ee4ca921ef55ae\src\wrapper.h(69): warning C5266: 'const' qualifier on return type has no effect
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 -IC:\Users\Al\Desktop\delme5\.venv\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\errors.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\errors.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      errors.cpp
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(343): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(367): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longintrepr.h(135): warning C4365: '=': conversion from 'uintptr_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/ceval.h(21): warning C5039: 'PyUnstable_Eval_RequestCodeExtraIndex': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/abstract.h(35): warning C4365: 'return': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Temp\pip-install-zxwsemfx\pyodbc_7d6499e66e99423bb1ee4ca921ef55ae\src\wrapper.h(69): warning C5266: 'const' qualifier on return type has no effect
      src\errors.cpp(272): warning C4365: 'argument': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 -IC:\Users\Al\Desktop\delme5\.venv\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\getdata.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\getdata.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      getdata.cpp
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(343): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(367): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longintrepr.h(135): warning C4365: '=': conversion from 'uintptr_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/ceval.h(21): warning C5039: 'PyUnstable_Eval_RequestCodeExtraIndex': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/abstract.h(35): warning C4365: 'return': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Temp\pip-install-zxwsemfx\pyodbc_7d6499e66e99423bb1ee4ca921ef55ae\src\wrapper.h(69): warning C5266: 'const' qualifier on return type has no effect
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 -IC:\Users\Al\Desktop\delme5\.venv\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\include -IC:\Users\Al\AppData\Local\Programs\Python\Python313\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpsrc\params.cpp /Fobuild\temp.win-amd64-cpython-313\Release\src\params.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      params.cpp
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(343): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/unicodeobject.h(367): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longintrepr.h(135): warning C4365: '=': conversion from 'uintptr_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/ceval.h(21): warning C5039: 'PyUnstable_Eval_RequestCodeExtraIndex': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/abstract.h(35): warning C4365: 'return': conversion from 'size_t' to 'Py_ssize_t', signed/unsigned mismatch
      C:\Users\Al\AppData\Local\Temp\pip-install-zxwsemfx\pyodbc_7d6499e66e99423bb1ee4ca921ef55ae\src\wrapper.h(69): warning C5266: 'const' qualifier on return type has no effect
      src\params.cpp(83): warning C4365: '=': conversion from 'SQLULEN' to 'SQLLEN', signed/unsigned mismatch
      src\params.cpp(91): warning C4365: '=': conversion from 'SQLULEN' to 'SQLLEN', signed/unsigned mismatch
      src\params.cpp(123): warning C4365: '=': conversion from 'SQLULEN' to 'SQLLEN', signed/unsigned mismatch
      src\params.cpp(248): warning C4365: '=': conversion from 'SQLCHAR' to 'SQLSCHAR', signed/unsigned mismatch
      src\params.cpp(250): error C2660: '_PyLong_AsByteArray': function does not take 5 arguments
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longobject.h(111): note: see declaration of '_PyLong_AsByteArray'
      src\params.cpp(250): note: while trying to match the argument list '(PyLongObject *, SQLCHAR [16], size_t, int, int)'
      src\params.cpp(287): warning C4365: 'argument': conversion from 'Py_ssize_t' to 'size_t', signed/unsigned mismatch
      src\params.cpp(326): warning C4365: 'argument': conversion from 'Py_ssize_t' to 'size_t', signed/unsigned mismatch
      src\params.cpp(344): warning C4365: 'initializing': conversion from 'int' to 'size_t', signed/unsigned mismatch
      src\params.cpp(346): warning C4365: 'initializing': conversion from 'int' to 'SQLUINTEGER', signed/unsigned mismatch
      src\params.cpp(374): warning C4365: '=': conversion from 'int' to 'SQLUINTEGER', signed/unsigned mismatch
      src\params.cpp(411): warning C4365: 'argument': conversion from 'Py_ssize_t' to 'size_t', signed/unsigned mismatch
      src\params.cpp(462): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'long', possible loss of data
      src\params.cpp(478): warning C4365: '=': conversion from 'SQLCHAR' to 'SQLSCHAR', signed/unsigned mismatch
      src\params.cpp(480): error C2660: '_PyLong_AsByteArray': function does not take 5 arguments
      C:\Users\Al\AppData\Local\Programs\Python\Python313\include\cpython/longobject.h(111): note: see declaration of '_PyLong_AsByteArray'
      src\params.cpp(480): note: while trying to match the argument list '(PyLongObject *, SQLCHAR [16], size_t, int, int)'
      src\params.cpp(992): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLUSMALLINT', possible loss of data
      src\params.cpp(992): warning C4365: 'argument': conversion from 'Py_ssize_t' to 'SQLUSMALLINT', signed/unsigned mismatch
      src\params.cpp(999): warning C4365: '=': conversion from 'Py_ssize_t' to 'SQLULEN', signed/unsigned mismatch
      src\params.cpp(1200): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLINTEGER', possible loss of data
      src\params.cpp(1200): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLSMALLINT', possible loss of data
      src\params.cpp(1210): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLINTEGER', possible loss of data
      src\params.cpp(1210): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLSMALLINT', possible loss of data
      src\params.cpp(1219): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLSMALLINT', possible loss of data
      src\params.cpp(1229): warning C4365: 'initializing': conversion from 'SQLULEN' to 'Py_ssize_t', signed/unsigned mismatch
      src\params.cpp(1258): warning C4365: 'argument': conversion from 'SQLULEN' to 'Py_ssize_t', signed/unsigned mismatch
      src\params.cpp(1479): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLUSMALLINT', possible loss of data
      src\params.cpp(1479): warning C4365: 'argument': conversion from 'Py_ssize_t' to 'SQLUSMALLINT', signed/unsigned mismatch
      src\params.cpp(1548): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLUSMALLINT', possible loss of data
      src\params.cpp(1548): warning C4365: 'argument': conversion from 'Py_ssize_t' to 'SQLUSMALLINT', signed/unsigned mismatch
      src\params.cpp(1561): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLSMALLINT', possible loss of data
      src\params.cpp(1562): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLSMALLINT', possible loss of data
      src\params.cpp(1563): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLSMALLINT', possible loss of data
      src\params.cpp(1564): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'SQLSMALLINT', possible loss of data
      src\params.cpp(1573): warning C4365: 'argument': conversion from 'Py_ssize_t' to 'size_t', signed/unsigned mismatch
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyodbc
Failed to build pyodbc
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyodbc)

Waiting for an update from the pyodbc project or using Python 3.12 are probably the best options.

Thank you. pip install git+https://github.com/mkleehammer/pyodbc worked for me.

Thank you for the suggestion on code formatting and confirming you are getting the same error. I will make sure I follow the standards going forward.

am also getting same error

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>pip install pyodbc
Collecting pyodbc
Using cached pyodbc-5.1.0.tar.gz (115 kB)
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing metadata (pyproject.toml) … done
Building wheels for collected packages: pyodbc
Building wheel for pyodbc (pyproject.toml) … error
error: subprocess-exited-with-error

× Building wheel for pyodbc (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [11 lines of output]
WARNING: ‘’ not a valid package name; please use only .-separated package names in setup.py
running bdist_wheel
running build
running build_py
creating build\lib.win32-cpython-313
copying src\pyodbc.pyi → build\lib.win32-cpython-313
running build_ext
building ‘pyodbc’ extension
creating build\temp.win32-cpython-313\Release\src
cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=5.1.0 -IC:\Users\mnmal\AppData\Local\Programs\Python\Python313\include -IC:\Users\mnmal\AppData\Local\Programs\Python\Python313\Include “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\cppwinrt” “-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\cppwinrt” “-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um” /EHsc /Tpsrc\cnxninfo.cpp /Fobuild\temp.win32-cpython-313\Release\src\cnxninfo.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
error: command ‘cl.exe’ failed: None
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyodbc
Failed to build pyodbc
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyodbc)

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>

This is failing in windows.

Uninstall 313, and install 312 resolved issue.

python -m pip install pyodbc
```resolved this issue for me