After installing pyodbc in a docker container I'm receiving the error:
File "/root/.local/lib/python3.10/site-packages/sqlalchemy/connectors/pyodbc.py", line 43, in dbapi
return __import__("pyodbc")
ImportError: libodbc.so.2: cannot open shared object file: No such file or directory
Any solution around this?
I tried uninstalling and reinstalling but no luck.
You need to install libodbc.so.2 on your system. The easiest way to do this is through your system's package manager.
For a Red Hat based distro, run: sudo yum install unixODBC
For a Debian based distro, run: sudo apt install unixodbc
For me, the solution to solve this problem was:
sudo apt remove libodbc2
sudo apt install libodbc2
I am using a distro based on Ubuntu 22.04 LTS (Jammy)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With