Gautham Kolluru
Gautham Kolluru

Reputation: 99

How to install pymssql module in Python 3.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.

Upvotes: 6

Views: 26451

Answers (4)

Milovan Tomašević
Milovan Tomašević

Reputation: 8673

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

Upvotes: 0

Mallinath Biswas
Mallinath Biswas

Reputation: 89

this seems to work from

export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1

pip install pymssql

Upvotes: 8

Deepak Harish
Deepak Harish

Reputation: 123

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.

Upvotes: 0

Benchur Wong
Benchur Wong

Reputation: 2635

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

Upvotes: 1

Related Questions