p.s.w.g
p.s.w.g

Reputation: 148980

Error Installing pymssql

I'm fairly new to Python development but very quickly I've run into a roadblock and I'm not sure how to resolve it. I am using Python 3.6 and VS Code as an IDE, but I also have VS 2015 Express and VS 2017 Build Tools installed on my machine. I've set up my project in VS Code and I've been able to install a couple of dependencies through pip already, but I'm stuck trying to install pymssql.

When I run this command the terminal, I get the following error:

PS C:\path\to\project> python -m pip install pymssql -t .\
Collecting pymssql
  Using cached pymssql-2.1.3.tar.gz
Installing collected packages: pymssql
  Running setup.py install for pymssql ... error
    Complete output from command C:\...\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\...\\Temp\\pip-build-sqfye0vh\\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 C:\...\pip-_407xunc-record\install-record.txt --single-version-externally-managed --compile --home=C:\...\Temp\tmpri_m4fvt:
    setup.py: platform.system() => 'Windows'
    setup.py: platform.architecture() => ('32bit', 'WindowsPE')
    running install
    running build
    running build_ext
    building '_mssql' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command "C:\...\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\...\\Temp\\pip-build-sqfye0vh\\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 C:\...\Temp\pip-_407xunc-record\install-record.txt --single-version-externally-managed --compile --home=C:\...\Temp\tmpri_m4fvt" failed with error code 1 in C:\Users\...\Temp\pip-build-sqfye0vh\pymssql\

Since I have VS 2015 and 2017 installed, I'm not sure what else could be missing. Can anyone give me some pointers for getting around this issue?

Upvotes: 6

Views: 26208

Answers (4)

Roshan Br
Roshan Br

Reputation: 360

Ran into the same issue, tried many things like installing MS Cpp build tools, configuring environment variables etc, finally below link helped.
I have Windows 10, Python 3.8, trying for the interpreter on PyCharm IDE

Just follow this link, its step-wise, self-explanatory and from official Microsoft site: Configure development environment for pymssql Python development

Upvotes: 1

Rupesh Kumar
Rupesh Kumar

Reputation: 136

I have Windows 10 with Python 3.6 on it and faced exactly similar issues. To resolve this follow:-

Step 1: Download the right version from the link: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql

Step 2: Executed the command:-

c:\Python27>pip install pymssql-2.2.0.dev0-cp36-cp36m-win_amd64.whl
Processing c:\python27\pymssql-2.2.0.dev0-cp36-cp36m-win_amd64.whl
Installing collected packages: pymssql
Successfully installed pymssql-2.2.0.dev0

Hope this helps...

Upvotes: 3

Laurent LAPORTE
Laurent LAPORTE

Reputation: 22942

Note: There are official releases for Python 2.7, 3.3, 3.4, 3.5, but not 3.6.

Since you are using Python 3.6, you need to use Microsoft Visual C++ 14.0 (standalone or with Visual Studio). The best resource is the Python Wiki page: Windows Compilers.

But, If you are in a hurry, you can install a binary release. You can pick up one in the Unofficial Windows Binaries for Python Extension Packages site.

Download the wheel file from the unofficial site, and run:

pip install pymssql-2.1.3-cp36-cp36m-win_amd64.whl

Or, you can also use the HTML link:

pip install http://www.lfd.uci.edu/~gohlke/pythonlibs/vu0h7y4r/pymssql-2.1.3-cp36-cp36m-win_amd64.whl

Make sure you have a recent version of pip (currently 9.0.1) and wheel (currently 0.29.0).

Again, I recommend you to use a virtualenv.

Upvotes: 11

Ignacio Vergara Kausel
Ignacio Vergara Kausel

Reputation: 5986

Looking around I found a site publishing wheels for pymssql‑2.1.3 for different versions of Python.

Check it here. Grab the one for your architecture do and give it a try by doing pip install <file>. Hopefully, it'll help you.

Upvotes: 4

Related Questions