Giter VIP home page Giter VIP logo

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)") about pyodbc HOT 5 CLOSED

Himanshup21234 avatar Himanshup21234 commented on July 18, 2024
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)")

from pyodbc.

Comments (5)

v-chojas avatar v-chojas commented on July 18, 2024 2

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

from pyodbc.

Himanshup21234 avatar Himanshup21234 commented on July 18, 2024
Screenshot 2024-04-17 at 12 56 18 PM

from pyodbc.

Himanshup21234 avatar Himanshup21234 commented on July 18, 2024

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

from pyodbc.

tatianass avatar tatianass commented on July 18, 2024

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: microsoft/homebrew-mssql-release#53

  • Uninstall M1 versions of brew packages (if installed at all):
brew uninstall unixodbc msodbcsql18 mssql-tools18
  • Install x86 Homebrew alongside the ARM M1 homebrew:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  • Then use x86 homebrew like arch -x86_64 /usr/local/bin/brew install or use the following alias (add to ~/.bash_profile or ~/.zshrc):
# Relies on having installed x86 brew like:
# arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
alias x86brew="arch -x86_64 /usr/local/bin/brew"
alias brew="/opt/homebrew/bin/brew"  # M1 version, to avoid from using x86 version accidentally
  • Install the ODBC packages.
x86brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
x86brew update
HOMEBREW_ACCEPT_EULA=Y x86brew install msodbcsql18 mssql-tools18
  • Create an x86 conda env with:
ENV_NAME="rosetta"
CONDA_SUBDIR=osx-64 conda create -n $ENV_NAME python
conda activate $ENV_NAME
conda config --env --set subdir osx-64
  • In order to install pyodbc, add to path (add to ~/.bash_profile or ~/.zshrc):
export LDFLAGS="-L/usr/local/Cellar/unixodbc/2.3.12/lib"
export CPPFLAGS="-I/usr/local/Cellar/unixodbc/2.3.12/include"
export PKG_CONFIG_PATH="/usr/local/Cellar/unixodbc/2.3.12/lib/pkgconfig"

PS: Pyodbc needs to be a recent version to be used with MAC M1.

from pyodbc.

v-chojas avatar v-chojas commented on July 18, 2024

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.

from pyodbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.