mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.89k stars 562 forks source link

it's not able to be installed on Win10 #1050

Closed Ken123456abcdefghijk closed 2 years ago

Ken123456abcdefghijk commented 2 years ago

Please first make sure you have looked at:

Environment

Win10 21H2 Professional + VS 2015 CE Python 3.10.4

Issue

it's not able to install django-mssql-backend I tried >pip install django-mssql-backend

Collecting django-mssql-backend Using cached django_mssql_backend-2.8.1-py3-none-any.whl (52 kB) Collecting pyodbc>=3.0 Using cached pyodbc-4.0.32.tar.gz (280 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 ╰─> [23 lines of output] running bdist_wheel running build running build_ext building 'pyodbc' extension creating build creating build\temp.win-amd64-3.10 creating build\temp.win-amd64-3.10\Release creating build\temp.win-amd64-3.10\Release\src C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=4.0.32 -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\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-3.10\Release\src\buffer.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4- buffer.cpp c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/abstract.h(58): warning C4365: 'return': conversion from 'std::size_t' to 'Py_ssize_t', signed/unsigned mismatch c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(75): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include\cpython/unicodeobject.h(551): note: see declaration of 'PyUnicode_FromUnicode' c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(86): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(580): note: see declaration of 'PyUnicode_AsUnicode' c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(126): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_length' c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(146): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_length' c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(147): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(580): note: see declaration of 'PyUnicode_AsUnicode' 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, django-mssql-backend 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 ╰─> [23 lines of output] running install running build running build_ext building 'pyodbc' extension creating build creating build\temp.win-amd64-3.10 creating build\temp.win-amd64-3.10\Release creating build\temp.win-amd64-3.10\Release\src C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=4.0.32 -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\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-3.10\Release\src\buffer.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4- buffer.cpp c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/abstract.h(58): warning C4365: 'return': conversion from 'std::size_t' to 'Py_ssize_t', signed/unsigned mismatch c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(75): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include\cpython/unicodeobject.h(551): note: see declaration of 'PyUnicode_FromUnicode' c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(86): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(580): note: see declaration of 'PyUnicode_AsUnicode' c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(126): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_length' c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(146): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_length' c:\users\redmond\appdata\local\temp\pip-install-v2z6hdwo\pyodbc_eed9f6f2056f4f00b1714df23b10f023\src\pyodbccompat.h(147): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(580): note: see declaration of 'PyUnicode_AsUnicode' 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.

Ken123456abcdefghijk commented 2 years ago

Collecting pyodbc Using cached pyodbc-4.0.32.tar.gz (280 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 ╰─> [23 lines of output] running bdist_wheel running build running build_ext building 'pyodbc' extension creating build creating build\temp.win-amd64-3.10 creating build\temp.win-amd64-3.10\Release creating build\temp.win-amd64-3.10\Release\src C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=4.0.32 -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\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-3.10\Release\src\buffer.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4- buffer.cpp c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/abstract.h(58): warning C4365: 'return': conversion from 'std::size_t' to 'Py_ssize_t', signed/unsigned mismatch c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(75): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include\cpython/unicodeobject.h(551): note: see declaration of 'PyUnicode_FromUnicode' c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(86): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(580): note: see declaration of 'PyUnicode_AsUnicode' c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(126): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_length' c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(146): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_length' c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(147): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(580): note: see declaration of 'PyUnicode_AsUnicode' 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 ╰─> [23 lines of output] running install running build running build_ext building 'pyodbc' extension creating build creating build\temp.win-amd64-3.10 creating build\temp.win-amd64-3.10\Release creating build\temp.win-amd64-3.10\Release\src C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=4.0.32 -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\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-3.10\Release\src\buffer.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191 /d2FH4- buffer.cpp c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/abstract.h(58): warning C4365: 'return': conversion from 'std::size_t' to 'Py_ssize_t', signed/unsigned mismatch c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(75): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include\cpython/unicodeobject.h(551): note: see declaration of 'PyUnicode_FromUnicode' c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(86): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(580): note: see declaration of 'PyUnicode_AsUnicode' c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(126): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_length' c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(146): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_length' c:\users\redmond\appdata\local\temp\pip-install-ipqe03r7\pyodbc_81c85e367663473cb82856dc022a65f5\src\pyodbccompat.h(147): warning C4996: 'PyUnicode_AsUnicode': deprecated in 3.3 c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.1264.0_x64qbz5n2kfra8p0\include\cpython/unicodeobject.h(580): note: see declaration of 'PyUnicode_AsUnicode' 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.

Ken123456abcdefghijk commented 2 years ago

thank you so much

gordthompson commented 2 years ago

https://github.com/mkleehammer/pyodbc/issues/981

v-chojas commented 2 years ago

Looks like this is new compiler option added for compatibility and not present before VS 2019. Remove the 3 lines here https://github.com/mkleehammer/pyodbc/blob/master/setup.py#L179 and try again? (Looks like that check should be on compiler version, not Python version.)

Ken123456abcdefghijk commented 2 years ago

981

hey really appreciated it

Ken123456abcdefghijk commented 2 years ago

Looks like this is new compiler option added for compatibility and not present before VS 2019. Remove the 3 lines here https://github.com/mkleehammer/pyodbc/blob/master/setup.py#L179 and try again? (Looks like that check should be on compiler version, not Python version.)

hey really appreciated it as well

hb2638 commented 2 years ago

If it helps. we run the following command to install the VC++ compiler on our machines. You can download the EXE from vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe

vs2019_buildtools.exe --nickname MSVCTools --wait --norestart --passive --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.18362

Ken123456abcdefghijk commented 2 years ago

If it helps. we run the following command to install the VC++ compiler on our machines. You can download the EXE from vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe

vs2019_buildtools.exe --nickname MSVCTools --wait --norestart --passive --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.18362

I appreciated you