0

I was trying to install pymssql library:

pip install pymssql

It gave the following error:

Collecting pymssql
  Downloading https://files.pythonhosted.org/packages/4c/c8/5ad36d8d3c304ab4f310c89d0593ab7b6229568dd8e9cde927311b2f0c00/pymssql-2.1.3.tar.gz (897kB)
    100% |████████████████████████████████| 901kB 1.1MB/s 
Installing collected packages: pymssql
  Running setup.py install for pymssql ... error
    Complete output from command /Users/hektor/Sites/venv2/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rv/vbf7xqh1601_xjkrn85w7hp00000gn/T/pip-install-60za8qcc/pymssql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/rv/vbf7xqh1601_xjkrn85w7hp00000gn/T/pip-record-vh_omvko/install-record.txt --single-version-externally-managed --compile --install-headers /Users/hektor/Sites/venv2/include/site/python3.5/pymssql:
    setup.py: platform.system() => 'Darwin'
    setup.py: platform.architecture() => ('64bit', '')
    setup.py: platform.libc_ver() => ('', '')
    setup.py: Detected Darwin/Mac OS X.
        You can install FreeTDS with Homebrew or MacPorts, or by downloading
        and compiling it yourself.

        Homebrew (http://brew.sh/)
        --------------------------
        brew install freetds

        MacPorts (http://www.macports.org/)
        -----------------------------------
        sudo port install freetds

    setup.py: Not using bundled FreeTDS
    setup.py: include_dirs = ['/usr/local/include']
    setup.py: library_dirs = ['/usr/local/lib']
    running install
    running build
    running build_ext
    building '_mssql' extension
    creating build
    creating build/temp.macosx-10.11-x86_64-3.5
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/Users/hektor/Sites/venv2/include -I/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c _mssql.c -o build/temp.macosx-10.11-x86_64-3.5/_mssql.o -DMSDBLIB
    _mssql.c:266:10: fatal error: 'sqlfront.h' file not found
    #include "sqlfront.h"
             ^~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1

As I understand from above that I need to install FreeTDS as indicated in their website

I installed FreeTDS with homebrew:

brew install freetds

After the installation was complete, I tried to run this command again:

pip install pymssql

However I got this error:

-bash: /Users/hektor/Sites/venv2/bin/pip: /Users/hektor/Sites/venv2/bin/python3: bad interpreter: No such file or directory

Additional information:

If I run which python:

/Users/hektor/anaconda2/bin/python

If I run which python3, then nothing returns.

I am using MacOS and my development environment is a virtual environment in my local machine.

How can I fix this problem? I had no such error until I try this pip installation.

fmw42
  • 46,825
  • 10
  • 62
  • 80
Hektor
  • 105
  • 3
  • 14
  • Why have you tagged this as `linux` and `macos`. Which is it, please? – Mark Setchell Jul 21 '18 at 19:16
  • Can you check the venv under `/Users/hektor/Sites/venv2` is still present? Can you activate it? – hoefling Jul 22 '18 at 07:30
  • Venv2 environment is already activated while I am trying these commands. @hoefling – Hektor Jul 22 '18 at 16:17
  • If the venv is activated and you get path to Python binary not from it when running `which python`, the venv is definitely broken, or you are modifying `PATH` after activation. – hoefling Jul 22 '18 at 16:22
  • do you suggest me to create a new virtual environment? @hoefling or what should I do to fix it? – Hektor Jul 22 '18 at 16:32
  • Creating a new venv and testing out the installation should be an easy task; just try it out. – hoefling Jul 22 '18 at 16:34
  • the bad news is that because `pip freeze` command also does not work, I cannot know which packages I have. Is there another way to learn it @hoefling? – Hektor Jul 22 '18 at 16:36
  • First check whether `pymssql` can be installed in a new venv at all. – hoefling Jul 22 '18 at 16:39
  • I even cannot create a new virtual environment. I cannot run this: `python3 -m venv venv3`. what the heck just happened to my local machine? @hoefling any idea? – Hektor Jul 22 '18 at 16:44
  • If `python3` is not found, it means that either Python 3 is not installed, or the executable not in `PATH`. Depending on how you installed Python 3, validate the installation, e.g. run `brew doctor` if you brewed one. – hoefling Jul 22 '18 at 16:55
  • I could be able to create a new venv and tried to install pymssql again but I am getting the same errors as I had before (pasted in the question) @hoefling – Hektor Jul 22 '18 at 17:15

0 Answers0