Installing Python pymssql Module

From PeformIQ Upgrade
Jump to navigation Jump to search

Problems

Cygwin

Looked like it installed OK.

$ pip install pymssql
Collecting pymssql
  Downloading pymssql-2.1.2.tar.gz (898kB)
    100% |████████████████████████████████| 901kB 134kB/s
Building wheels for collected packages: pymssql
  Running setup.py bdist_wheel for pymssql ... done
  Stored in directory: /home/aasdev/.cache/pip/wheels/08/df/03/0c92949cb5ecc9002cb965d135f1dec326cb7881f3e0bb80be
Successfully built pymssql
Installing collected packages: pymssql
Successfully installed pymssql-2.1.2

Windows

When I attempt to run a windows script which imports pymssql it fails:

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
>>>

Notes

Found this somewhere:

"Tried to install pymssql into cygwin python install using pip. There isn't currently any cygwin specific install instructions at http://pymssql.org but with a quick read it was obvious that pymssql has a dependency on FreeTDS that could be satisfied by installing FreeTDS package from the cygwin setup utility, however cygwin doesn't currently have any "freetds-dev" or "freetds-devel" package and it took quite a bit of head scratching to figure out the header files required by the pip build could be found in the the cygwin "libsybdb-devel" package"

After installing the cygwin "freetds" and "libsybdb-devel" packages I ran the pip install again and it worked!

$ pip install pymssql
Collecting pymssql
  Using cached pymssql-2.1.3.tar.gz
Installing collected packages: pymssql
  Running setup.py install for pymssql ... done
Successfully installed pymssql-2.1.3

Also

https://pypi.python.org/pypi/pymssql/2.1.3#downloads

2019 Problems

Upgraded cygwin to use Python 3.8

Upgraded pip to 19.3.1

Attempted an install of pymssql on Windows Server 2019

$ pip3 --version
pip 19.2.3 from /usr/lib/python3.8/site-packages/pip (python 3.8)


$ pip3 install pip --upgrade
Collecting pip
  Using cached https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-19.3.1


$ pip3 --version
pip 19.3.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)


$ pip3 install pymssql
Collecting pymssql
  Using cached https://files.pythonhosted.org/packages/2e/81/99562b93d75f3fc5956fa65decfb35b38a4ee97cf93c1d0d3cb799fffb99/pymssql-2.1.4.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.8.exe -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oq72usqd/pymssql/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oq72usqd/pymssql/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-oq72usqd/pymssql/pip-egg-info
         cwd: /tmp/pip-install-oq72usqd/pymssql/
    Complete output (7 lines):
    /usr/lib/python3.8/site-packages/setuptools/dist.py:45: DistDeprecationWarning: Do not call this function
      warnings.warn("Do not call this function", DistDeprecationWarning)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-oq72usqd/pymssql/setup.py", line 88, in <module>
        from Cython.Distutils import build_ext as _build_ext
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.


$ pip3 install Cython
Collecting Cython
  Downloading https://files.pythonhosted.org/packages/a5/1f/c7c5450c60a90ce058b47ecf60bb5be2bfe46f952ed1d3b95d1d677588be/Cython-0.29.13.tar.gz (2.1MB)
     |████████████████████████████████| 2.1MB 2.9MB/s
Building wheels for collected packages: Cython
  Building wheel for Cython (setup.py) ... done
  Created wheel for Cython: filename=Cython-0.29.13-cp38-cp38-cygwin_3_0_7_x86_64.whl size=5158306 sha256=7c4b2d4827797c543c7a97942ce1ed6bd74916ef207860b9c905ee87cf781553
  Stored in directory: /home/plh/.cache/pip/wheels/5b/1e/17/15dd6d435ec0644967eb8e1493af09ae28cd94184c6f416d02
Successfully built Cython
Installing collected packages: Cython
Successfully installed Cython-0.29.13



$ pip3 install pymssql
Collecting pymssql
  Using cached https://files.pythonhosted.org/packages/2e/81/99562b93d75f3fc5956fa65decfb35b38a4ee97cf93c1d0d3cb799fffb99/pymssql-2.1.4.tar.gz
Building wheels for collected packages: pymssql
  Building wheel for pymssql (setup.py) ... done
  Created wheel for pymssql: filename=pymssql-2.1.4-cp38-cp38-cygwin_3_0_7_x86_64.whl size=1188638 sha256=fa29a41bd62ba1b3e8ba464dec9783e6ed44362c651fcab345d5d9e9e03a8ede
  Stored in directory: /home/plh/.cache/pip/wheels/21/35/92/911576b44bbe7c19ff65d0f90a4af9a9571db4af36ffd3ede1
Successfully built pymssql
Installing collected packages: pymssql
Successfully installed pymssql-2.1.4

That worked.