ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects
Asked Answered
S

5

8

I have an issue with installing pymsql, any of you had a similar case?

I've found the similar issue to my for M1 user Link

Also I've try:

Upgrade pip with: python -m pip install --upgrade pip

Upgrade wheel with: pip install --upgrade wheel

Upgrade setuptools with: pip install --upgrade setuptools

When I try install that then I received:

Collecting pymssql
  Using cached pymssql-2.2.2.tar.gz (170 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: startedNote: you may need to restart the kernel to use updated packages.
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: pymssql
  Building wheel for pymssql (pyproject.toml): started

  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\mikol\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\mikol\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\mikol\AppData\Local\Temp\tmpli4438o6'
       cwd: C:\Users\mikol\AppData\Local\Temp\pip-install-f4z0veo1\pymssql_f17e29cc25734af0a975be16add0d1d8
  Complete output (23 lines):
  setup.py: platform.system() => Windows
  setup.py: platform.architecture() => ('64bit', 'WindowsPE')
  setup.py: include_dirs => []
  setup.py: library_dirs => []
  running bdist_wheel
  running build  Building wheel for pymssql (pyproject.toml): finished with status 'error'
Failed to build pymssql

  running build_py
  creating build
  creating build\lib.win-amd64-3.10
  creating build\lib.win-amd64-3.10\pymssql
  copying src\pymssql\__init__.py -> build\lib.win-amd64-3.10\pymssql
  running build_ext
  cythoning src\pymssql\_mssql.pyx to src\pymssql\_mssql.c
  cythoning src\pymssql\_pymssql.pyx to src\pymssql\_pymssql.c
  building 'pymssql._mssql' 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\pymssql
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\mikol\AppData\Local\Programs\Python\Python310\include -IC:\Users\mikol\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\pymssql\_mssql.c /Fobuild\temp.win-amd64-3.10\Release\src\pymssql\_mssql.obj -DMSDBLIB
  _mssql.c
  src\pymssql\_mssql.c(682): fatal error C1083: Nie moľna otworzy† pliku do\x88Ącz: 'sqlfront.h': No such file or directory
  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
  ----------------------------------------
  ERROR: Failed building wheel for pymssql
ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects

Any suggestions on how to fix it'll be appreciated a lot.

Salade answered 18/12, 2021 at 13:17 Comment(2)
It's weird when I install the pymssql, the pip will download the .whl file, and need not build a wheel for pymssql. Could you try to reinstall it without cache? pip --no-cache-dir install pymssqlImitate
For a while, I also thought it might be a problem with the Python version and support for 3.10 ... But you were right, with the use of ``` pip --no-cache-dir install pymssql ``` installed correctly. Thanks a lot!Salade
P
8

I had a similar error on macOS (M1 chip) when trying to install tap-mssql. Their documentation gives instructions for resolving the fatal error: 'sqlfront.h' file not found on macOS. After I ran the following I was able to pip install pymsql (well, in my case it was pip install tap-mssql):

brew install freetds
Pulse answered 4/1, 2023 at 4:8 Comment(0)
G
2

I don't think what I'm about to say is an answer but I do like to chip in to possibly help others who might come across this in future. (I was going to write this in as a comment but I only have 3 rep. point)

My machine is not M1 (It is Intel CPU running Windows 10) and I think many of my environment is different to OP but I did managed to get error which resembles much of what OP got.

I originally went around it by doing 'pip --no-cache-dir install pymssql' too. Which worked well. Graz to @Steven-MSFT

But I stumbled on few more errors (not with pymssql) after that that made me realize I was doing 'pip install -r requirement.txt' on a brand new OS with Python 3.11.1 using the requirement.txt file built by the machine with Python 3.10.4

I didn't realize it would make that much of difference. Apparently it does. Anyway, basically what I'm trying to say is that reason why module is trying to build wheel for pymssql could possibly be that particular version pymssql you are trying to install may not have been made right for your Python environment.

Reason why I suspected that is because after I uninstalled 3.11.1 and installed 3.10.4 (which is what I should have done in the first place) 'pip install -r requirement.txt' worked like a charm.

So, anyway this is my two cents' worth.

FYI: pymssql version that I had trouble installing was 2.2.5

Gallic answered 19/12, 2022 at 6:53 Comment(0)
D
0

I was facing the same issue and my error was not installing the correct pymysql

The documentation (https://pymysql.readthedocs.io/en/latest/user/installation.html) says that you should install

python3 -m pip install PyMySQL

This worked for me

Demilitarize answered 24/2, 2023 at 13:49 Comment(0)
R
0

I had a similar error on macOS (M2 chip) when trying to install pymssql. I have made a post on this SO thread detailing that.

The gist is (1) find a version of python that works (my system/xcode python was 3.9 and i had been using 3.12 with homebrew), (2) see if the @mcfizz freetds link fix works for you, and then (3) reinstall everything else you need to that version of python.

I finally found 3.10 works, but if python/pip is a new concept to you, let me exhort you to be sure your pip is installing to your python interpreter. After following these instructions you may also need to install anything else you were using (in my case, ansible).

brew install [email protected]
myfreetds=$(brew --prefix freetds)
export LDFLAGS="-L$myfreetds/lib"
export CPPFLAGS="-I$myfreetds/include"
pip3.10 install pymysql
Righthand answered 25/9 at 13:2 Comment(0)
P
-1

Try this

sudo apt-get install python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
Pericranium answered 6/9, 2022 at 7:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.