mac - pip install pymssql error

Found Detailed and simple answer with step by step installation of pymssql on http://gree2.github.io/python/setup/2017/04/19/python-instal-pymssql-on-mac.

  1. brew unlink freetds; brew install homebrew/core/freetds091
  2. brew link --force [email protected]
  3. pip install pymssql

The top voted solution did not work for me as brew did not link the older version of freetds on its own. I did this to solve the problem:

brew unlink freetds; 
brew install [email protected];
brew link --force [email protected]

I was able to work around this by reverting to an older version of FreeTDS through Homebrew before running the pip install.

brew unlink freetds; brew install homebrew/versions/freetds091

The solution was found by andrewmwhite at: https://github.com/pymssql/pymssql/issues/432


Found a solution for pip/python2 & pip3/python3

Problem:

I was Unable to get a successful build from pip3 following @siva & @himanshu workaround works for python2 but not for python3.

pip3 install pymssql

    ..._mssql.c:21155:15: error: use of undeclared identifier 'DBVERSION_80'
        __pyx_r = DBVERSION_80;
                  ^
    1 error generated.
    error: command 'clang' failed with exit status 1

Your issue is not a permission issue, but, a code-compiling issue with dependent code for pymssql.

Here's the discussion, Where I found the Solution on github.

It has been around for a while at this point, just placing here for visibility.

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

OR

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

I Tested on Mac OS X (10.13.6) & Homebrew (1.7.1-62-gddbefee) multiple times. The command works for both versions of freetds (0.91) or (1.00.94)