ModuleNotFoundError: No module named 'pymssql
Answered
I imported the following modules:
import sqlalchemy
from sqlalchemy import create_engine, text, exc
from sqlalchemy.dialects.mssql import pymssql
Set-up a connection to SQL Server
engine = sqlalchemy.create_engine('mssql+pymssql://localhost\\SQLEXPRESS/NORTHWND?trusted_connection=yes')
conn = engine.connect()
I get the following error:
module = __import__('pymssql')
ModuleNotFoundError: No module named 'pymssql'
I looked at the folder listed in the error msg (C:\Python36\lib\site-packages\sqlalchemy\dialects\mssql\pymssql.py)
The file is there?? 
Any suggestions appreciated.
Please sign in to leave a comment.
Hello,
I see your request on YouTrack: https://youtrack.jetbrains.com/issue/PY-28766. It's a known issue with building pymssql on Windows: https://github.com/pymssql/pymssql/issues/439
I had this same exact issue and was confused in the same way. I found this page googling for a solution.
It turns out that you must have two modules named 'pymssql'. You have one within sqlalchemy, you might not have the other. Once I installed the other 'pymssql' module with
pip install pymssql
the other required module was installed.
This worked for me. Hope this helps.