pyodbc drivers not found when using Jupyter via Anaconda, works everywhere else

Viewed 182

My OS is Mac Big Sur is 11.6 (20G165). I am trying to connect to Azure Server.

When I try in Jupyter Notebook, which I am running via Anaconda, I get the following error:

Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")

When I check the pyodbc drivers (also in Anaconda's Notebooks), it's empty.

import pyodbc
pyodbc.drivers()
[]

However, I can connect to the desired connection via terminal

isql -v -k 'my connection string' 
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> 

as well as checking pyodbc in Python outside Anaconda shows the correct driver

python3                                                                                                                                                                                                                         
Python 3.9.7 (default, Oct 13 2021, 06:45:31) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
>>> print(pyodbc.drivers())
['ODBC Driver 17 for SQL Server']

I am guessing it has smth to do with Anaconda's virtual environment, but what can I do to make Anaconda's pyodbc point to the correct location?

0 Answers
Related