I have both the Intel and Apple silicon versions of PyCharm installed on my Mac, and I'm attempting to run a project locally that utilizes PyODBC to connect to a SQL Server database. I've already installed the necessary ODBC Driver for SQL Server. However, I've encountered an issue: I can successfully run the project using the Intel version of PyCharm, but I'm facing difficulties with the Apple silicon version, specifically with ODBC driver version 18.
Upon investigation, I realized that the two versions of PyCharm are sourcing the odbcinst.ini file from different locations, and ODBC driver version 18 is missing from apple silicon version. To address this, I modified the odbcinst.ini file for the Apple silicon version as follows:
[ODBC Driver 13 for SQL Server]Description=Microsoft ODBC Driver 13 for SQL ServerDriver=/usr/local/lib/libmsodbcsql.13.dylibUsageCount=1[ODBC Driver 17 for SQL Server]Description=Microsoft ODBC Driver 17 for SQL ServerDriver=/opt/homebrew/lib/libmsodbcsql.17.dylibUsageCount=1[ODBC Driver 18 for SQL Server]Description=Microsoft ODBC Driver 18 for SQL ServerDriver=/usr/local/lib/libmsodbcsql.18.dylibUsageCount=1
However, despite ensuring that the path for ODBC driver 18 is correct, I'm encountering the following error when attempting to run the program:
(pyodbc.Error) ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libmsodbcsql.18.dylib' : file not found (0) (SQLDriverConnect)")
I'm confident that the path for the driver is accurate, as the Intel version is functioning correctly with identical configurations. How can I resolve this issue? Is it possible to change the path to the odbcinst.ini file to ensure that the Apple silicon version of PyCharm recognizes the ODBC driver properly?