Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 804
Jacob Kapitein Avatar asked Jan 08 '21 10:01

Jacob Kapitein


People also ask

Could not build wheels for Pygobject which use PEP 517 and Cannot be installed directly?

To Solve ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly Error Just update your pip and your error will be solve. pip3 install –upgrade pip. this error solved just after update pip with setuptools wheel just run below command. pip install –upgrade pip setuptools wheel.

What is pep517?

PEP 517 specifies a standard API for systems which build Python packages. PEP 660 extends it with a build mode that leads to editable installs. This package contains wrappers around the hooks specified by PEP 517 and PEP 660.

Why can't I run pep 517 on PYPA?

On further investigation, I found this pypa/pip#6256 which suggests the issue is that wheels simply aren't supported with PEP 517 builds. My best guess would be to pip install --upgrade pip setuptools wheel and that should resolve the issue.

Why can't I install wheel in Pip?

In which case try pip install <insert package names> --no-cache-dir. This seems to be a frequent issue when installing packages with python. First, check to ensure you have activated the virtualenv you think you're supposed to be in, then check to see if you have wheels pkg (pip install wheel if not).

Does pep517 have problems with virtualenvs?

QUICK UPDATE I took some time to research the internet about: PEP517 have some problems with virtualenvs but i already tried --no-use-pep517 with no success and still retrying an error.

Why can't I install a wheel package with Python?

This seems to be a frequent issue when installing packages with python. First, check to ensure you have activated the virtualenv you think you're supposed to be in, then check to see if you have wheels pkg (pip install wheel if not). If those fail then the --no-cache-dir or --no-binary flags come into play.


Video Answer


3 Answers

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.

like image 73
AKX Avatar answered Oct 11 '22 15:10

AKX


I meet the same error,different solution.

I.m using mac + py3.9

solution:

brew install freetds

error info:

Collecting pymssql
  Using cached pymssql-2.1.5.tar.gz (167 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: pymssql
  Building wheel for pymssql (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/[email protected]/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/ch/88r0y0hx02v5v903bl4pf4c40000gn/T/tmp053ptsxm
       cwd: /private/var/folders/ch/88r0y0hx02v5v903bl4pf4c40000gn/T/pip-install-klunmran/pymssql
  Complete output (33 lines):
  setup.py: platform.system() => 'Darwin'
  setup.py: platform.architecture() => ('64bit', '')
  setup.py: platform.libc_ver() => ('', '')
  setup.py: Detected Darwin/Mac OS X.
      You can install FreeTDS with Homebrew or MacPorts, or by downloading
      and compiling it yourself.

      Homebrew (http://brew.sh/)
      --------------------------
      brew install freetds

      MacPorts (http://www.macports.org/)
      -----------------------------------
      sudo port install freetds

  setup.py: Not using bundled FreeTDS
  setup.py: include_dirs = ['/usr/local/include']
  setup.py: library_dirs = ['/usr/local/lib']
  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.macosx-10.15-x86_64-3.9
  creating build/temp.macosx-10.15-x86_64-3.9/src
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_mssql.c -o build/temp.macosx-10.15-x86_64-3.9/src/_mssql.o -DMSDBLIB
  src/_mssql.c:611:10: fatal error: 'sqlfront.h' file not found
  #include "sqlfront.h"
           ^~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  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
like image 36
pepper Avatar answered Oct 11 '22 15:10

pepper


After changing the version of Python from 3.8.2 to 3.9.5, was able to run the pip command.

like image 1
Ибрахим Ильясов Avatar answered Oct 11 '22 16:10

Ибрахим Ильясов