I am trying to import following:
from azure.eventhub import EventData
from azure.eventhub.aio import EventHubProducerClient
from azure.eventhub.exceptions import EventHubError
I get error:
from azure.eventhub import EventData
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
>>> from azure.eventhub.aio import EventHubProducerClient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
>>> from azure.eventhub.exceptions import EventHubError
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
PS- I already did pip install for azure-eventhub. I am running this on Mac M1 machine, with Python: 3.10.6 and pip 22.2.2.
What needs to be fixed/imported to resolve the error?
3
Answers
On Python 3.10 you can update to the latest uamqp package to get Apple M1 support:
Version 1.6.1 and above will support M1 on Python 3.10 and later
Try installing uamqp from source instead of wheel/binary.
Remove the eventhub and uamqp libraries first:
Install uamqp from source first:
This worked for me on my M1. See if this works for you as well.
I wanted to provide an update. My team just released a new version of the Event Hubs SDK which is using a new AMQP stack written all in Python and removes the dependency on uamqp. This allows us to support the SDK on multiple platforms with no breaking changes. You can
pip install azure-eventhub >= 5.11.0
to get the latest version. For further information please see the announcement and the readme for backwards compatibility with uamqp