pythonpippymssql

ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly


I'm trying to install pymssql from pip on Windows. Problem is, I keep getting the following error:

ERROR: Failed building wheel for pymssql
Failed to build pymssql
ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly

Full log is as follows:

Building wheels for collected packages: pymssql
  Building wheel for pymssql (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\administrator\appdata\local\programs\python\python39\python.exe' 'c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\ADMINI~1\AppData\Local\Temp\tmpvh65n1en'
       cwd: C:\Users\Administrator\AppData\Local\Temp\pip-install-skfrg8ce\pymssql_3826b234076b47ab9618e9d73ff9698b
  Complete output (16 lines):
  setup.py: platform.system() => 'Windows'
  setup.py: platform.architecture() => ('64bit', 'WindowsPE')
  running bdist_wheel
  running build
  running build_ext
  cythoning src\_mssql.pyx to src\_mssql.c
  cythoning src\pymssql.pyx to src\pymssql.c
  building '_mssql' extension
  creating build
  creating build\temp.win-amd64-3.9
  creating build\temp.win-amd64-3.9\Release
  creating build\temp.win-amd64-3.9\Release\src
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ifreetds\include -IC:\Users\Administrator\AppData\Local\Temp\pip-install-skfrg8ce\pymssql_3826b234076b47ab9618e9d73ff9698b\build\include -Ic:\users\administrator\appdata\local\programs\python\python39\include -Ic:\users\administrator\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /Tcsrc\_mssql.c /Fobuild\temp.win-amd64-3.9\Release\src\_mssql.obj -DMSDBLIB
  _mssql.c
  src\_mssql.c(611): fatal error C1083: Cannot open include file: 'sqlfront.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

Has anybody had this issue? I've searched far and wide, but no answers. I tried downgrading pip and also tried install older versions of pymssql, but no luck.


Solution

  • You're missing some header (and likely library) files needed to build the extension.

    Unless you want to build from scratch, it'll probably be easier to get the suitable prebuilt wheel from Dave Gohlke's Windows wheels page and install it with Pip. Be sure to choose the correct file for your Python version and bitness.