Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install fails under python 3.11 on Windows #1109

Closed
zobac opened this issue Oct 26, 2022 · 9 comments
Closed

install fails under python 3.11 on Windows #1109

zobac opened this issue Oct 26, 2022 · 9 comments

Comments

@zobac
Copy link

zobac commented Oct 26, 2022

Please first make sure you have looked at:
OS: Windows 10 64 bit
Python: 3.11.0

pip install pyodbc

Collecting pyodbc
  Using cached http://svn.ca.convergentmfg.com:4040/root/pypi/%2Bf/7ea/7869532b96b8d/pyodbc-4.0.34.tar.gz (271 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=4.0.34 -IE:\Envs\pyodbcTest\include -IC:\Python311\include -IC:\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tpsrc\buffer.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src\buffer.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      buffer.cpp
      c:\python311\include\cpython/unicodeobject.h(423): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      c:\python311\include\cpython/unicodeobject.h(450): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      c:\python311\include\cpython/abstract.h(59): warning C4365: 'return': conversion from 'std::size_t' to 'Py_ssize_t', signed/unsigned mismatch
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(75): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(600): note: see declaration of 'PyUnicode_FromUnicode'
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(86): warning C4996: 'PyUnicode_AS_UNICODE': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(685): note: see declaration of 'PyUnicode_AS_UNICODE'
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(126): warning C4996: 'PyUnicode_GET_SIZE': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(652): note: see declaration of 'PyUnicode_GET_SIZE'
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(146): warning C4996: 'PyUnicode_GET_SIZE': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(652): note: see declaration of 'PyUnicode_GET_SIZE'
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(147): warning C4996: 'PyUnicode_AS_UNICODE': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(685): note: see declaration of 'PyUnicode_AS_UNICODE'
      fatal error C1007: unrecognized flag '-FH4-' in 'p2'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyodbc
  Running setup.py clean for pyodbc
Failed to build pyodbc
Installing collected packages: pyodbc
  Running setup.py install for pyodbc ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pyodbc did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      running install
      E:\Envs\pyodbcTest\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=4.0.34 -IE:\Envs\pyodbcTest\include -IC:\Python311\include -IC:\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tpsrc\buffer.cpp /Fobuild\temp.win-amd64-cpython-311\Release\src\buffer.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4-
      buffer.cpp
      c:\python311\include\cpython/unicodeobject.h(423): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      c:\python311\include\cpython/unicodeobject.h(450): warning C4365: '=': conversion from 'unsigned int' to 'int', signed/unsigned mismatch
      c:\python311\include\cpython/abstract.h(59): warning C4365: 'return': conversion from 'std::size_t' to 'Py_ssize_t', signed/unsigned mismatch
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(75): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(600): note: see declaration of 'PyUnicode_FromUnicode'
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(86): warning C4996: 'PyUnicode_AS_UNICODE': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(685): note: see declaration of 'PyUnicode_AS_UNICODE'
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(126): warning C4996: 'PyUnicode_GET_SIZE': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(652): note: see declaration of 'PyUnicode_GET_SIZE'
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(146): warning C4996: 'PyUnicode_GET_SIZE': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(652): note: see declaration of 'PyUnicode_GET_SIZE'
      c:\users\guy\appdata\local\temp\pip-install-zr1skgw9\pyodbc_74ec003573f34a98941d5dd4119322b2\src\pyodbccompat.h(147): warning C4996: 'PyUnicode_AS_UNICODE': deprecated in 3.3
      c:\python311\include\cpython/unicodeobject.h(685): note: see declaration of 'PyUnicode_AS_UNICODE'
      fatal error C1007: unrecognized flag '-FH4-' in 'p2'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyodbc

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
@v-chojas
Copy link
Contributor

The FH4 option appeared only in VS 2019.

https://github.com/mkleehammer/pyodbc/blob/master/setup.py#L179

Looks like the option should only be added if the compiler version is new enough.

@gordthompson gordthompson changed the title package doesn't install under python 3.11 install fails under python 3.11 on Windows Oct 28, 2022
@gordthompson
Copy link
Collaborator

gordthompson commented Oct 28, 2022

If you are having difficulty getting pyodbc to install from source on Windows you could try one of these unofficial wheels:

(Files removed. See below.)

@SimoneD89
Copy link

AppVeyor deployed new Windows images with Python 3.11 support, see appveyor/ci#3844. Therefore, it is in principle possible to use it to build win wheels for pyodbc (py3.11)

@gordthompson
Copy link
Collaborator

@SimoneD89 - #1115

@scotscotmcc
Copy link

The unofficial wheels given by GordThompson above cause an issue with creating sqlalchemy engines. sqlalchemy assumes that the version scheme is all integers, but the above version is 4.0.dev0, and so when creating an engine with sqlalchemy you get ValueError: invalid literal for int() with base 10: '' from where the regex fails to pull the third element from the version and so tries int('')

@keitherskine
Copy link
Collaborator

Yes @scotscotmcc , those wheels should not be labelled 4.0.dev0, even if they are unofficial. I'm working on a fix, shouldn't take too long. Watch this space.

@keitherskine
Copy link
Collaborator

Hopefully, PR #1121 should fix this. It may be possible for you to download the artifacts from the CI pipeline (look for the file called "wheels"). That zip file should contain installable Windows wheels.

@scotscotmcc
Copy link

@keitherskine, the wheel in that download you have above appears to work just fine. Thanks a bunch!

@mkleehammer
Copy link
Owner

Thanks to an amazing job by @keitherskine, new releases build official wheels now. There is an official 4.0.35 wheel available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants