Search code examples
pythonmsbuildpymssql

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?


Solution

  • 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.