Azure / azure-uamqp-python

AMQP 1.0 client library for Python
MIT License
56 stars 48 forks source link

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

Open JrtPec opened 2 years ago

JrtPec commented 2 years ago

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...

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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

could you tell me more about:

jimbobbennett commented 2 years ago

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.

https://github.com/Azure/azure-iot-cli-extension/issues/468

askpatrickw commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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

That's it, hope it helps.

trevors20 commented 1 year ago

@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 commented 1 year ago

lots of m1 users these days. bump.

ChrsBaur commented 1 year ago

Are there any updates on this issue?

uccsjarmo commented 6 months ago

Any updates with this issue?