How I got pyodbc and Oracle Instant Client working on Ubuntu

A guide of questionable universality

Photo by Michael Schofield on Unsplash


apt-get -y install unixodbc-dev

Get and install the Oracle Instant Client downloads

apt-get install -y alienalien -i oracle-instantclient-basic-
alien -i oracle-instantclient-odbc-
alien -i oracle-instantclient-devel-
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/oracle/21/client64/lib"

Add an entry for the driver in odbcinst.ini

echo '' | tee -a /etc/odbcinst.iniecho '[MyOracle]' | tee -a /etc/odbcinst.iniecho 'Description=Oracle driver' | tee -a /etc/odbcinst.iniecho 'Driver=/usr/lib/oracle/21/client64/lib/' | tee -a /etc/odbcinst.iniecho 'UsageCount=1' | tee -a /etc/odbcinst.iniecho 'FileUsage=1' | tee -a /etc/odbcinst.ini
sudo tee -a /etc/systemd/system/task_id_mgr.service > /dev/null <<EOT
Description=Oracle Unicode driver

Did you get an error?!

[unixODBC][Driver Manager]Can't open lib '/usr/lib/oracle/21/client64/lib/' : file not found...
ldd /usr/lib/oracle/21/client64/lib/
apt-get install libaio1 libaio-dev

Parting thoughts

John is a software engineer who primarily works in data science platform design.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store