anthony-tuininga / ceODBC

Python module for accessing databases using the ODBC API.
https://anthony-tuininga.github.io/ceODBC/
12 stars 8 forks source link

ERROR: Failed building wheel for ceODBC #11

Closed elanora96 closed 1 year ago

elanora96 commented 2 years ago

I'm having trouble installing ceODBC on Windows 10 Pro 1903. I really don't know where to go from here so I'll just paste the output of the failed install.

PS C:\Users\Redacted\Desktop\project> python -m pip install ceODBC --upgrade
Collecting ceODBC
  Using cached ceODBC-3.0.tar.gz (161 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ceODBC
  Building wheel for ceODBC (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for ceODBC (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [70 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      creating build\lib.win-amd64-3.10\ceODBC
      copying src\ceODBC\constants.py -> build\lib.win-amd64-3.10\ceODBC
      copying src\ceODBC\constructors.py -> build\lib.win-amd64-3.10\ceODBC
      copying src\ceODBC\exceptions.py -> build\lib.win-amd64-3.10\ceODBC
      copying src\ceODBC\version.py -> build\lib.win-amd64-3.10\ceODBC
      copying src\ceODBC\__init__.py -> build\lib.win-amd64-3.10\ceODBC
      running build_ext
      skipping 'src/ceODBC\driver.c' Cython extension (up-to-date)
      building 'ceODBC.driver' extension
      creating build\temp.win-amd64-3.10
      creating build\temp.win-amd64-3.10\Release
      creating build\temp.win-amd64-3.10\Release\src
      creating build\temp.win-amd64-3.10\Release\src\ceODBC
      "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 -IC:\Users\Redacted\AppData\Local\Programs\Python\Python310\include -IC:\Users\Redacted\AppData\Local\Programs\Python\Python310\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" /Tcsrc/ceODBC\driver.c /Fobuild\temp.win-amd64-3.10\Release\src/ceODBC\driver.obj
      driver.c
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(289): error C2061: syntax error: identifier 'DWORD'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(290): error C2061: syntax error: identifier 'Data2'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(290): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(291): error C2061: syntax error: identifier 'Data3'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(291): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(292): error C2061: syntax error: identifier 'Data4'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(292): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(292): error C2059: syntax error: '['
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqltypes.h(293): error C2059: syntax error: '}'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2170): error C2146: syntax error: missing ')' before identifier 'szFileName'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2170): error C2061: syntax error: identifier 'szFileName'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2170): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2170): error C2059: syntax error: ','
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2173): error C2059: syntax error: ')'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2176): error C2061: syntax error: identifier 'TraceReturn'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2176): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2176): error C2059: syntax error: '<parameter-list>'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2177): error C2061: syntax error: identifier 'TraceVersion'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2177): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2177): error C2059: syntax error: '<parameter-list>'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2195): error C2061: syntax error: identifier 'ODBCSetTryWaitValue'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2195): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2195): error C2146: syntax error: missing ')' before identifier 'dwValue'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2195): error C2061: syntax error: identifier 'dwValue'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2195): error C2059: syntax error: ')'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2196): error C2061: syntax error: identifier 'ODBCGetTryWaitValue'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2196): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2196): error C2059: syntax error: '<parameter-list>'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2218): error C2143: syntax error: missing ';' before '*'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2218): error C2059: syntax error: '*'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2219): error C2061: syntax error: identifier 'dwFlags'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2219): error C2059: syntax error: ';'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2221): error C2061: syntax error: identifier 'WCHAR'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2222): error C2143: syntax error: missing '{' before '*'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2223): error C2059: syntax error: '}'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2225): error C2061: syntax error: identifier 'WCHAR'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2226): error C2143: syntax error: missing '{' before '*'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2227): error C2059: syntax error: '}'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2229): error C2059: syntax error: '}'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2231): error C2061: syntax error: identifier 'FireVSDebugEvent'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\sqlext.h(2231): error C2059: syntax error: ';'
      src/ceODBC\driver.c(3667): warning C4244: 'function': conversion from 'SQLINTEGER' to 'SQLSMALLINT', possible loss of data
      src/ceODBC\driver.c(6508): warning C4244: '=': conversion from 'Py_ssize_t' to 'SQLUINTEGER', possible loss of data
      src/ceODBC\driver.c(6553): warning C4244: '=': conversion from 'Py_ssize_t' to 'SQLUINTEGER', possible loss of data
      src/ceODBC\driver.c(14772): warning C4244: 'function': conversion from 'SQLULEN' to 'SQLUINTEGER', possible loss of data
      src/ceODBC\driver.c(15394): warning C4018: '<': signed/unsigned mismatch
      src/ceODBC\driver.c(16266): warning C4312: 'type cast': conversion from 'unsigned long' to 'SQLPOINTER' of greater size
      src/ceODBC\driver.c(17691): warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned int', possible loss of data
      src/ceODBC\driver.c(18516): warning C4244: 'function': conversion from 'Py_ssize_t' to 'SQLUINTEGER', possible loss of data
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\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 ceODBC
Failed to build ceODBC
ERROR: Could not build wheels for ceODBC, which is required to install pyproject.toml-based projects
anthony-tuininga commented 2 years ago

That's weird. The errors appear to be occurring inside your "Windows Kits" -- which should, you would think, be internally consistent! I don't use Windows much so hopefully someone else can help you with that issue or you can find a way to workaround the issue.

One thing you might check: in odbc.pxd these lines occur at the beginning of the file:

IF UNAME_SYSNAME == "Windows":
    cdef extern from "<windows.h>":
        pass

Check to see if those are actually being run. Perhaps that condition is not being satisfied? You can always remove the condition and see if the problem goes away for you?

elanora96 commented 2 years ago

Thank you for looking into this! Those lines are required for building on Windows, but I don't think they are running in the PyPI version? I cloned this repo and was able to successfully build it locally, and when I commented those lines out the build failed with the error that I posted above. Looking at commits since 3.0, I'm not certain what fixed it, but I'm happy to confirm 3.1 will be working 😀.

anthony-tuininga commented 1 year ago

Well, 3.1 was just released. I assume that means this issue is resolved! If not, feel free to re-open.