0

I have installed pyodbc but unable to import it.

python 3.8.10 Mac OS Monterey, M1 chip

>>> import pyodbc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen({env_path}env/lib/python3.8/site-packages/pyodbc.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '_SQLAllocHandle'
>>> 

if any one has any solutions please post.

I tried installing pyodbc using brew, installed unixodbc also. tried installing using pip install --no-binary :all: pyodbc none of the above approach worked.

Kaleb
  • 17
  • 1
  • 6

1 Answers1

0

The issue was resolved for me on MacOS Ventura 13.2 in this answer, but using pip3 instead of pip. To reiterate (with pip3):

  1. Uninstall pyodbc:
pip3 uninstall pyodbc
  1. Install it again, but compiled locally:
pip3 install --no-binary :all: pyodbc

As mentioned in the linked answer, make sure that unixodbc is installed. Using brew:

brew install unixodbc
Kaleb
  • 17
  • 1
  • 6