Steps to install PYODBC on Ubuntu and the requirements that needed to be done to convert from PYMSSQL to PYODBC for connecting to an MS SQL database to pull information. Just wanted to get all of these steps in one place and everything that I went through to get it working in my Linux environment.
sudo curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add –
#Download appropriate package for the OS version
#Choose only ONE of the following, corresponding to your OS version
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
curl https://packages.microsoft.com/config/ubuntu/19.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
sudo apt-get install unixodbc-dev
Once the driver is installed you then need to install pyodbc with pip
pip3 install pyodbc
After I did these steps it then did require me to reinstall the requests module for some reason to resolve some HTTPS issues. Not really sure what that issue was or the reason for it.
Reference links for the installs from Microsoft: