6
votes

I have been through a couple of documentations involving FreeTDS, Wheel, git and github but nothing was working on my Windows 10 PC with Python 3.6 but I need to install it. I'm working on a project and I'm most comfortable with mssql which is already installed in my pc.

4
Would you show us what you have tried so far, and any errors that you received?halfer
I succesfully installed it from pre-built wheel at lfd.uci.edu/~gohlke/pythonlibs/#pymssqlNikoNyrh

4 Answers

8
votes

this seems to work from

export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1

pip install pymssql

1
votes

Remember to install FreeTDS first.

Ubuntu/Debian:

sudo apt-get install freetds-dev

Mac OS X with Homebrew:

brew install freetds

Finally:

pip install pymssql
0
votes

As the site pymssql_documentation page states that the module is deprecated,

we can use pip install "pymssql<3.0". It works on python 3.0 and above.

I think they should change it in the main copy area as well. as of 12/17/2019 it is still showing pip install pymssql, which has been updated on Nov 16 2019.

0
votes

Just use the newest build of pymssql from gitub:

pip3 install git+https://github.com/pymssql/pymssql

Also works for python2

pip install git+https://github.com/pymssql/pymssql

For macOS Big Sur Apple M1 chip processor:

  • You will need to install Rosetta2 emulator for the new ARM silicon (M1 chip). I just installed Rosetta2 via terminal using:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
  • Homebrew for ARM M1 chip:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  • Homebrew for M1 ARM command to install packages: arch -x86_64 brew install <package>. It is necessary to install FreeTDS before installing the pymssql.
arch -x86_64 brew install freetds

Finally:

pip install pymssql

output:

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) ... done
  Created wheel for pymssql: filename=pymssql-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl size=287029 
.
.
.
Successfully built pymssql
Installing collected packages: pymssql
Successfully installed pymssql-2.1.5