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

[bug] - UAMQP / monitor-events - Apple Silicon is not supported #468

Open
jimbobbennett opened this issue Dec 1, 2021 · 4 comments
Open

Comments

@jimbobbennett
Copy link

Describe the bug

When running this extension on a Mac using Apple Silicon, an error is thrown by UAMQP that the hardware is not supported.

To Reproduce

Use an Apple Silicon based Mac.
Install the az cli and the IoT extension
Try to use the extension, for example to monitor a hub

Expected behavior

It should work

Environment (please complete the following information):

  • OS: macOS 12.0.1 running on a M1-based MacBookPro
  • Shell: zsh
  • Az CLI version: 2.30.0
  • IoT extension version:0.11.0
  • Python version (if pip installed): 3.9.7

Additional context

Error message:

➜  ~ az iot hub monitor-events --hub-name animal-tracker
The command failed with an unexpected error. Here is the traceback:
dlopen(/Users/jim/.azure/cliextensions/azure-iot/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): tried: '/Users/jim/.azure/cliextensions/azure-iot/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)
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/homebrew/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/Users/jim/.azure/cliextensions/azure-iot/azext_iot/operations/hub.py", line 2942, in iot_hub_monitor_events
    _iot_hub_monitor_events(
  File "/Users/jim/.azure/cliextensions/azure-iot/azext_iot/operations/hub.py", line 3055, in _iot_hub_monitor_events
    from azext_iot.monitor.builders import hub_target_builder
  File "/Users/jim/.azure/cliextensions/azure-iot/azext_iot/monitor/builders/hub_target_builder.py", line 8, in <module>
    import uamqp
  File "/Users/jim/.azure/cliextensions/azure-iot/uamqp/__init__.py", line 12, in <module>
    from uamqp import c_uamqp  # pylint: disable=import-self
ImportError: dlopen(/Users/jim/.azure/cliextensions/azure-iot/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): tried: '/Users/jim/.azure/cliextensions/azure-iot/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)

This also appears to be a new issue - this was used earlier this year with no problems (before July 2021).

@jimbobbennett
Copy link
Author

Update on working before - I wonder if the Azure CLI was running under Rosetta 2 before, so was ok with the x86_64 builds.

@jimbobbennett
Copy link
Author

Issue raised for UAMQP for lack of Apple Silicon support: Azure/azure-uamqp-python#284

@jimbobbennett
Copy link
Author

Update - I can make this work by:

  • Creating a new virtual environment
  • Installing uamqp in the virtual environment without using binaries, so it is rebuilt for arm64: pip install uamqp --no-binary uamqp --no-cache-dir
  • Copying the uamqp folder from my virtual environment into the extension at `~/.azure/cliextensions/azure-iot'

So as a fix - can the setup code for this extension be changed to install uamqp with the no-binary flag? Not sure how to do this in a setup.py.

@deeTEEcee
Copy link

For me, this was a better approach than having to copy-paste with #468 (comment).

@c-ryan-k c-ryan-k changed the title [bug] Apple Silicon is not supported [bug] - UAMQP / monitor-events - Apple Silicon is not supported Dec 20, 2022
@c-ryan-k c-ryan-k pinned this issue Dec 20, 2022
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

3 participants