-
Notifications
You must be signed in to change notification settings - Fork 565
Need Apple Silicon / M1 builds #846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I was able to run it under Mac OS 11.0 on a MacBook Air with the new M1 chip. |
That said, the ARM Mac ODBC drivers which you will need are probably still rather uncommon for the time being, given that Apple just released the new M1 Macs recently. |
I'm able to install, but running
If I look at The main departure from the install instructions for me is that I used MacPorts (Homebrew does not work for M1 yet). I wonder if that has anything to do with it (i.e. files being located in |
You can see which unixODBC the pyODBC has linked to, run
|
I'm getting:
|
That indicates it will be loaded from whatever happens to be in the rpath when the Python is running, and since that depends on what other libraries it has, it is probably easier to run |
I'm going to rename this to emphasize the issue is Apple Silicon / M1 compatibility. I have access to an M1 Air (though I'm not sure the wife is going to like that :) ) but I've been waiting because of the Homebrew issue. I'm interested in any feedback people have and suggestions on which DBs can be run natively on the M1 for testing. |
Just FYI @mkleehammer |
Hi, I am having a fatal error: 'sql.h' file not found error. sql.h doesn't look to be part of the package. |
You need to install unixODBC. Please, read the documentation: https://github.com/mkleehammer/pyodbc/wiki/Building-pyodbc-from-source |
I don't see any documentation from your link that talks about the installation of unixODBC specific for Apple Silicon/M1 , can you provide exact steps if you were successful? |
Hi,
I have installed unixodbc via brew; and installed correctly.
However, when installing pyodbc, I get the following error message,
followed by more information, with mention sql.h is not found
Collecting pyodbc
Using cached pyodbc-4.0.30.tar.gz (266 kB)
Building wheels for collected packages: pyodbc
Building wheel for pyodbc (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/marcozanella/.pyenv/versions/3.9.1/bin/python3.9 -u -c
'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/private/var/folders/dk/kq7_26dj5z79542rb3jp0c340000gn/T/pip-install-05exfppr/pyodbc_64a047783b5647e98f08d3659e1cd34b/setup.py'"'"';
__file__='"'"'/private/var/folders/dk/kq7_26dj5z79542rb3jp0c340000gn/T/pip-install-05exfppr/pyodbc_64a047783b5647e98f08d3659e1cd34b/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
bdist_wheel -d
/private/var/folders/dk/kq7_26dj5z79542rb3jp0c340000gn/T/pip-wheel-de40jc02
cwd:
/private/var/folders/dk/kq7_26dj5z79542rb3jp0c340000gn/T/pip-install-05exfppr/pyodbc_64a047783b5647e98f08d3659e1cd34b/
Complete output (14 lines):
running bdist_wheel
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.macosx-11.2-arm64-3.9
creating build/temp.macosx-11.2-arm64-3.9/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g
-fwrapv -O3 -Wall
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
-DPYODBC_VERSION=4.0.30 -UMAC_OS_X_VERSION_10_7
-I/Users/marcozanella/.pyenv/versions/3.9.1/include/python3.9 -c
src/buffer.cpp -o build/temp.macosx-11.2-arm64-3.9/src/buffer.o
-Wno-write-strings -Wno-deprecated-declarations
In file included from src/buffer.cpp:12:
src/pyodbc.h:56:10: fatal error: 'sql.h' file not found
#include <sql.h>
^~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
…----------------------------------------
ERROR: Failed building wheel for pyodbc
I will check if I could build from source, according to your suggestions.
Thanks
Marco
On Tue, Feb 9, 2021 at 4:35 PM v-chojas ***@***.***> wrote:
You need to install unixODBC. Please, read the documentation:
https://github.com/mkleehammer/pyodbc/wiki/Building-pyodbc-from-source
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#846 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKGK47UZYN4EDDTBB5ENJ3S6FI4LANCNFSM4T3ALN3A>
.
--
Marco Zanella
[email protected]
|
I managed to solve the
Hope it helps. |
Thanks @michalpulpan. I can confirm that the following works on my MacBook M1:
pip is here an aliased to |
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 Do I have to install the Homebrew version of python3? |
Hello, same and weird issue. Installation in my M1 Mac Mini was working fine. Now attempting to install pyodbc on M1 Macbook Air results in error
|
@preske87 if you are using the brew version of the Python 3.9.5 or the default 3.8 version of Python. They are having some bug. I fixed this by uninstalling the brew version of Python and installing python 3.9.5 graphical from Python website. Maybe this would fix the issue |
I solved this issue using the soft linking to unixODBC folder, as I have unix odbc from brew and Python3 from Graphical installation . But the the error arrises that states that architecture is not compatible. |
That occurs if you are mixing ARM and x86 binaries. Note that unless you have native ARM ODBC drivers available that you can use with pyODBC, everything should "just work" if you have a consistently x86 environment and use Rosetta2 emulation instead. |
Just tried again:
|
Yep that's the issue with the Mac M1 Silicon Built MacBooks. The PyODBC I guess is not yet supported as when I try to create a soft link with the UniXODBC, it shows Architecture not compatible |
Do anyone here is using PyODBC on Mac M1 silicon processor? |
That's the x86 version. You'll also need the x86 version of unixODBC installed in order to use it. |
OK, I am using |
So, any idea how we can install the same if it is already available? |
Yes, docker using plattform linux/amd64 |
I have my old Intel Macbook Air and I can use my wife's M1. (It will take some convincing that I won't mess it up ;) I'm using LInux exclusively on my new job so I haven't been keeping up. Does anyone know what has been ported and what hasn't? I assume there is an M1 Python build. What about unixODBC and PostgreSQLs ODBC driver? Does brew provide an easy way to tell which is which when working on the M1? |
Yep, that is works perfectly fine. I am using the Conda Miniforge, and was facing the issue if file sqlfront.h not found error. So, I figured it out by using
and then
Free TDS won't be detected by any virtual Environment untill brew version of Python is installed. Also figured out that Microsoft has clearly mentioned that Microsoft ODBC drivers are not currently supported on M1 powered machines. So PyODBC would not work, even if we install the same on our environment. We however would need to use docker. After all we can directly install pymssql
and it would work fine |
I was really hoping GitHub Actions would already support M1 runners which we could use for automated tests and packaging, but they aren't ready yet: actions/runner-images#2187 You'd think Apple might kick in some resources to help with this. I have access to my wife's M1 so I'll be looking at this again soon. |
I'd be happy to kick in $100 towards an m1 fund to get you resources to resolve this issue if someone wants to start said fund. I've tried everything and nothing works for me. I'm trying the new MSODBC SQL 17 drivers for the m1. isql and sqlcmd work, but pyodbc always complains: Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/homebrew/lib/libmsodbcsql.17.dylib' : file not found (0) (SQLDriverConnect)") I built pyodbc from source: these both work out ok: print(os.access('/opt/anaconda/2020/envs/py_37_pands0.25/lib/python3.8/site-packages/pyodbc-4.0.32-py3.8-macosx-10.9-x86_64.egg/pyodbc.cpython-38-darwin.so', os.R_OK)) |
Was able to get around the Have spent some time attempting to debug this but not getting anywhere at the moment. Would be extremely grateful for any pointers! |
Are you attempting to use Rosetta2 emulation, or native ARM? These M1s can run both, but your software needs to be fully consistent in architecture from Python to pyODBC to unixODBC to the ODBC driver whichever you choose - you cannot mix e.g. ARM Python with x86 pyODBC. |
I've just noticed that the ODBC driver is x86 - thanks for the rapid response! |
To fix the new homebrew dir path on mac m1: i just created a symlink from new homebrew dir to the old one |
Be careful to not mix the two architecture's binaries, because that will cause a lot of confusion. |
This one worked for me.
In these 2 commands just change the version of unixodbc which you are using. |
M1 mac: pyodbc cause python crashed Process: Python [3968] Date/Time: 2022-01-07 12:17:23.448 +0800 Sleep/Wake UUID: 71F09A45-CB35-4D64-AF8E-73786861C2FF Time Awake Since Boot: 3000 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Application Specific Information: Thread 0 Crashed:: Dispatch queue: com.apple.main-thread Thread 0 crashed with ARM Thread State (64-bit): Binary Images: External Modification Summary: VM Region Summary:
REGION TYPE SIZE COUNT (non-coalesced) Model: MacBookAir10,1, BootROM 6723.140.2, proc 8:4:4 processors, 16 GB, SMC |
I am also getting the above error. Anyone got any hints for dealing with it? |
I don't know what you mean by "above error". Please be specific and provide as much detail as you can. |
I think the error by @hxmwr is because the ODBC Microsoft Library is for |
If the To get your export path run
That
What wasn't workign for me above was that extra |
I spent the better part of a day figuring this out so far -- the main change from what's above is adding It looks like in many but not all cases the following will work, because lots of formula link their libs & includes to these directories (e.g. I couldn't see that openssl or FreeTDS do, but maybe I missed it) -- I tested installingpyodbc with the following, and it worked (caveat: there's a lot of stuff in the hombrew lib/include dirs, so it might need the FreeTDS or openssl stuff, I dunno):
But if you want to collect 'em all, here's the summary/aggregation of what I've done in since yesterday
|
Hi, all 👋 ! I really appreciate the great workarounds listed here and all the shared experiences. The I was just wondering if there is any plan and timeline for releasing wheels for |
This fixed it for me. I had the error with sql.h while trying to start a virtual environment with pyodbc. |
Installation fails on Mac OS 11.0
It seems the binary have not been released yet.
Manual installation fails as well from whl file :
Do you know any workaround?
The text was updated successfully, but these errors were encountered: