6

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
Gautham Kolluru
  • 99
  • 1
  • 1
  • 7

4 Answers4

8

this seems to work from

export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1

pip install pymssql

Community
  • 1
  • 1
1

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
Benchur Wong
  • 2,377
  • 2
  • 9
  • 13
0

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.

Deepak Harish
  • 123
  • 2
  • 7
0

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

UPDATE:

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
Milovan Tomašević
  • 6,823
  • 1
  • 50
  • 42