mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.88k stars 561 forks source link

I am trying to install pyodbc in MacBook Pro M3 chip - arm64. The drivers are installed succesfully for odbc 13,17 and 18. But pyodbc is not able to detect the drivers. ERROR: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)") #1346

Closed Himanshup21234 closed 1 month ago

Himanshup21234 commented 2 months ago

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be sure to specify 32-bit Python or 64-bit:

Issue

I have Mac M3 Pro, trying to connect to Azure SQL server using pyodbc. my settings works well on my previous mac intel chip base laptop, but not here. This is the error I get when trying to connect to sql server using pyodbc

Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/homebrew/lib/libmsodbcsql.17.dylib' : file not found (0) (SQLDriverConnect)")

I checked lipo -info /opt/homebrew/Cellar/msodbcsql18/18.1.1.1/lib/libmsodbcsql.18.dylib

Himanshup21234 commented 2 months ago
Screenshot 2024-04-17 at 12 56 18 PM
v-chojas commented 2 months ago

Are you using an arm64 or amd64 Python? The issue form asks those questions for a reason, so fill it in.

Himanshup21234 commented 2 months ago

@v-chojas ARM64 - I am using Apple M3 Pro.

tatianass commented 1 month ago

I used this tutorial to make it work on my M1 mac, maybe it can help you.

PS: Don't forgot to change the 18s to 17, since that's the driver version you want.

Tutorial

Following: https://github.com/microsoft/homebrew-mssql-release/issues/53

v-chojas commented 1 month ago

That will work if you need to run x86 Python on an arm64 Mac for some reason, but beware that if you have other Python packages that are arm64, your x86 Python won't work with them.