Pymssql install error No module named ‘Cython’

after:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pymssql
I get:
ERROR: Command errored out with exit status 1:
command: ‘c:\users\winuser\appdata\local\programs\python\python38\python.exe’ -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\winuser\AppData\Local\Temp\pip-install-sdpiavgz\pymssql\setup.py’"’"’; file=’"’"‘C:\Users\winuser\AppData\Local\Temp\pip-install-sdpiavgz\pymssql\setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ egg_info --egg-base ‘C:\Users\winuser\AppData\Local\Temp\pip-install-sdpiavgz\pymssql\pip-egg-info’
cwd: C:\Users\winuser\AppData\Local\Temp\pip-install-sdpiavgz\pymssql
Complete output (7 lines):
c:\users\winuser\appdata\local\programs\python\python38\lib\site-packages\setuptools\dist.py:45: DistDeprecationWarning: Do not call this function
warnings.warn(“Do not call this function”, DistDeprecationWarning)
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\winuser\AppData\Local\Temp\pip-install-sdpiavgz\pymssql\setup.py”, line 88, in
from Cython.Distutils import build_ext as _build_ext
ModuleNotFoundError: No module named ‘Cython’
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
How do I deal with it?

1 Like

This is a known quirk of pymssql, you need to install cython first before installing it. But you probably want to migrate to pyodbc instead.

1 Like