sql.h not found when installing PyODBC on Heroku sql.h not found when installing PyODBC on Heroku python python

sql.h not found when installing PyODBC on Heroku


To follow up on the answer below...

Example for Ubuntu:

sudo apt-get install unixodbc unixodbc-dev

Example for CentOS:

sudo yum install unixODBC-devel

Example for Fedora:

sudo dnf install unixODBC-devel

On Windows:

conn = pyodbc.connect('DRIVER={SQL Server};SERVER=yourserver.yourcompany.com;DATABASE=yourdb;UID=user;PWD=password')

On Linux:

conn = pyodbc.connect('DRIVER={FreeTDS};SERVER=yourserver.yourcompany.com;PORT=1433;DATABASE=yourdb;UID=user;PWD=password;TDS_VERSION=7.2')


You can add Heroku build pack to preinstall required apt packages first

heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt

Add Aptfile in the your directory root and to the repository as well

unixodbcunixodbc-devpython-pyodbclibsqliteodbc

It will install everything you need to work with pyodbc or aioodbc packages from python on Heroku


You need the unixODBC devel package. I don't know what distro you are using but you can google it and build from source.