-
-
Save rosiecakes/89d3e77c8dded619ed34dc44d25dd33a to your computer and use it in GitHub Desktop.
| Homebrew set up to install to /Users/shimadar/usr/local instead of /usr/local | |
| I'm running OSX 10.11.6, Python 3.5.2, pyenv 1.0.6, pyodbc 4.0.1 (via pip). | |
| Went through [this][1] and connect fine with both tsql and isql as shown in the walkthrough. | |
| Still cannot import pyodbc. | |
| >>> import pyodbc | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| ImportError: dlopen(/Users/shimadar/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pyodbc.cpython-35m-darwin.so, 2): Library not loaded: /usr/local/opt/unixodbc/lib/libodbc.2.dylib | |
| Referenced from: /Users/shimadar/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pyodbc.cpython-35m-darwin.so | |
| Reason: image not found | |
| Realized lib path slightly different. | |
| $ otool -L /Users/shimadar/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pyodbc.cpython-35m-darwin.so | |
| /Users/shimadar/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pyodbc.cpython-35m-darwin.so: | |
| /usr/local/opt/unixodbc/lib/libodbc.2.dylib (compatibility version 3.0.0, current version 3.0.0) | |
| /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0) | |
| /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0) | |
| Changed the path and now it imports. | |
| $ install_name_tool -change /usr/local/opt/unixodbc/lib/libodbc.2.dylib /Users/shimadar/usr/local/opt/unixodbc/lib/libodbc.2.dylib /Users/shimadar/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pyodbc.cpython-35m-darwin.so | |
| [1]: https://github.com/lionheart/django-pyodbc/wiki/Mac-setup-to-connect-to-a-MS-SQL-Server | |
| [2]: http://stackoverflow.com/questions/6383310/python-mysqldb-library-not-loaded-libmysqlclient-18-dylib |
I figured out I was missing the brew install unixodbc. This solved my issue. Thanks for your help @rosiecakes
brew install unixodbc - this worked for me as well, fantastic! Thank you all so much!
Thanks @rdelduca - brew install unixodbc worked beautifully.
brew install unixodbc fixed the issue for me
This is a bit of a hack, but ...
sudo mkdir -p /usr/local/opt/unixodbc
sudo ln -s /usr/local/homebrew/Cellar/unixodbc/2.3.9/lib /usr/local/opt/unixodbc/lib
ls -la /usr/local/opt/unixodbc/lib
... /usr/local/opt/unixodbc/lib -> /usr/local/homebrew/Cellar/unixodbc/2.3.9/lib
Voila!
Simply installing unixodbc did not work for me.
Thanks @rdelduca, brew install unixodbc also worked for me.
awesome. thanks, @rdelduca, brew install unixodbc worked for me
brew install unixodbc works !!
brew install unixodbc was the way to go for me, thanks @serbi.
Just another comment here that yeah, brew install unixodbc does get me past the error in import pyodbc.
🤷🏻♂️
Just in case someone else runs across this, I was able to resolve this by installing the unixodbc driver via brew:
brew install unixodbc
Thanks for this it fixed my issue
I did install the unixODBC using Homebrew. And I have the Python installed using the Graphic Installer, instead of Homebrew installation of Python.
I don't know if it is creating the problem, but installing the unixodbc is still throwing the same error after importing pyodbc
I did also tried using brew install python3, but Homebrew version of python do not install the other libraries like Pandas, Numpy, Pyodbc too. So I installed the Python3 graphically and got all the other libraries installed.
I have MacBook Air M1
Just in case someone else runs across this, I was able to resolve this by installing the unixodbc driver via brew:
brew install unixodbcThanks for this it fixed my issue
Which Mac model do you have?
i think there is an issue with the mac m1's
even if you set the path to the
This is a bit of a hack, but ...
sudo mkdir -p /usr/local/opt/unixodbc sudo ln -s /usr/local/homebrew/Cellar/unixodbc/2.3.9/lib /usr/local/opt/unixodbc/lib ls -la /usr/local/opt/unixodbc/lib ... /usr/local/opt/unixodbc/lib -> /usr/local/homebrew/Cellar/unixodbc/2.3.9/libVoila!
Simply installing unixodbc did not work for me.
as https://gist.github.com/rosiecakes/89d3e77c8dded619ed34dc44d25dd33a#gistcomment-3463218
the error i got was :
Reason: no suitable image found. Did find: /usr/local/opt/unixodbc/lib/libodbc.2.dylib: mach-o, but wrong architecture /usr/local/opt/unixodbc/lib/libodbc.2.dylib: stat() failed with errno=25 /opt/homebrew/Cellar/unixodbc/2.3.9_1/lib/libodbc.2.dylib: mach-o, but wrong architecture
Any ideas on how to proceed ?
brew install unixodbc. This solved my issue
Thank All
brew install unixodbc
This did help me
did you try the install_name_tool mentioned in my post? that has fixed this issue throughout several updates for me.