Skip to content
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

ImportError: dlopen(...c_uamqp.cpython-310-darwin.so): mach-o file, incompatible architecture (have 'x86_64', need 'arm64e') #284

Open
JrtPec opened this issue Nov 8, 2021 · 12 comments

Comments

@JrtPec
Copy link

JrtPec commented Nov 8, 2021

I have a Mac with M1-processor, so as long as not all Python packages are published as arm64 or universal binaries I have to run Python in emulated mode under Rosetta 2.

So when I saw that uamqp was released as universal binary, I gave it a go. But it still fails like I've installed it for the wrong architecture...

  • MacBook Pro M1
  • macOS Monterey 12.0.1
  • Python 3.10.0 installed through Brew on arm64 (arch -arm64 brew install [email protected])
  • pip install uamqp in my Py3.10 venv installs uamqp-1.4.3-cp310-cp310-macosx_10_9_universal2.whl
ImportError: dlopen(venv_arm/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): tried: 'venv_arm/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/c_uamqp.cpython-310-darwin.so' (no such file), '/usr/lib/c_uamqp.cpython-310-darwin.so' (no such file)

So when I install the same package under Python 3.10.0 installed through my x86_64 version of brew, it works just fine.

@yunhaoling
Copy link
Contributor

hey @JrtPec , I'm sorry to tell you that right now we don't provide binary whls for ARM architecture and we neither have the plan to support it in the near future. apologize for the inconvenience that is brought to you.

Our team is putting efforts into implementing a pure python amqp library to get rid of the complexity multi platform support.

may I ask what's your scenario with Apple M1, is it for development or for deployment?
if it's for development, could be try download the source code and build the uamqp whl locally?

like the following:

pip install uamqp --no-binary :all:

just note that you may need to install the required components as per:
https://github.com/Azure/azure-uamqp-python#installation

@trevors20
Copy link

@yunhaoling , do you have a timeline on when your new library that you are building can be used? Apple M1 is a hot topic these days and uamqp not supporting M1 blocks our tooling that we are running in production. I.e. the workaround for building on the fly wouldn't really work for us. Thanks for any info!!!

@yunhaoling
Copy link
Contributor

hey @trevors20 , thanks for reaching out and sharing the information that you're working with M1 in production.

could you tell me more about:

  • are you using the uamqp library alone, or using azure-eventhub/azure-servicebus SDK which depends on Apple M1?
  • "the workaround for building on the fly wouldn't really work for us.", why it doesn't work? is it because of the OS environment which missed dependencies/packages to build uamqp manually?

@jimbobbennett
Copy link

This is needed so the Azure IoT extension for the Azure CLI can run on M1 Macs. Seeing as the M1 has been out for over a year, we really should support it.

Azure/azure-iot-cli-extension#468

@askpatrickw
Copy link

I can also confirm I am hitting this on my M1 Mac...

If you end up here. The workaround is to run commands in the Azure Cloud Shell.
https://docs.microsoft.com/en-us/azure/cloud-shell/overview

@dishults
Copy link

What worked for me was brew install cmake and adding uamqp --no-binary uamqp to the requirement.txt file before azure packages or just installing it separately pip3 install uamqp --no-binary uamqp and then installing the rest.
Though, native support would still be much appreciated :)

@karishma-kohli
Copy link

@dishults could you please elaborate more on the steps you did after running brew install cmake? I am not heavily into python but I am stuck with this error while running ansible jobs.

Appreciate your help.

@dishults
Copy link

@karishma-kohli Sure! Here are all the steps I took after installing cmake:

  • brew install [email protected]
  • brew link [email protected]
  • installed and configured virtualenvwrapper
  • created new python environment mkvirtualenv -p python3.10 test
  • in the new environment, installed this package first with pip install uamqp --no-binary uamqp or with pip install uamqp --no-binary uamqp --no-cache-dir to avoid broken cache
  • installed all other python packages

That's it, hope it helps.

@trevors20
Copy link

@yunhaoling / @dishults , I'm not sure I can use those workarounds in my environment. What I have built is an Azure CLI Extension. I just wrap up the python code and all of it's dependencies (like uamqp) into a whl package. The whl package is installed as an extension on Azure CLI and it "just works" for the platforms that we run the extension on. Except for the M1 platform.
As part of bundling up the whl package, are there easy steps to do something where the whl could be installed on the M1 platform and it would work as well as the other platforms as well?

Or, does uamqp now support M1? Or, is there something else that we should be using in replace of uaqmp that would give us the platform support that we need?

@deeTEEcee
Copy link

lots of m1 users these days. bump.

@ChrsBaur
Copy link

Are there any updates on this issue?

@uccsjarmo
Copy link

Any updates with this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants