Azure / azure-iot-cli-extension

Azure IoT extension for Azure CLI
Other
83 stars 65 forks source link

ImportError: cannot import name 'c_uamqp' #523

Closed bvyas94 closed 2 years ago

bvyas94 commented 2 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az iot hub monitor-events Extension Name: azure-iot. Version: 0.13.0.

Errors:

The command failed with an unexpected error. Here is the traceback:
cannot import name 'c_uamqp' from partially initialized module 'uamqp' (most likely due to a circular import) (/home/expert/.azure/cliextensions/azure-iot/uamqp/__init__.py)
Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/home/expert/.azure/cliextensions/azure-iot/azext_iot/operations/hub.py", line 2945, in iot_hub_monitor_events
    _iot_hub_monitor_events(
  File "/home/expert/.azure/cliextensions/azure-iot/azext_iot/operations/hub.py", line 3058, in _iot_hub_monitor_events
    from azext_iot.monitor.builders import hub_target_builder
  File "/home/expert/.azure/cliextensions/azure-iot/azext_iot/monitor/builders/hub_target_builder.py", line 8, in <module>
    import uamqp
  File "/home/expert/.azure/cliextensions/azure-iot/uamqp/__init__.py", line 12, in <module>
    from uamqp import c_uamqp  # pylint: disable=import-self
ImportError: cannot import name 'c_uamqp' from partially initialized module 'uamqp' (most likely due to a circular import) (/home/expert/.azure/cliextensions/azure-iot/uamqp/__init__.py)

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

Environment Summary

Linux-5.4.0-1080-azure-x86_64-with-glibc2.28 (Cloud Shell), Common Base Linux Delridge (quinault)
Python 3.10.4
Installer: DEB

azure-cli 2.37.0

Extensions:
azure-iot 0.13.0
azure-cli-iot-ext 0.7.0
ai-examples 0.2.5
ssh 1.1.1

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

vilit1 commented 2 years ago

Try running the command with repair: az iot hub monitor-events --hub-name {} --device-id {} -r

The uamqp package has issues with certain versions and the repair command will reinstall uamqp with the correct version (that has no issues)

bvyas94 commented 2 years ago

Okay, Thank you

It works!

On Tue, 14 Jun, 2022, 23:48 Victoria Litvinova, @.***> wrote:

Try running the command with repair: az iot hub monitor-events --hub-name {} --device-id {} -r

The uamqp package has issues with certain versions and the repair command will reinstall uamqp with the correct version (that has no issues)

— Reply to this email directly, view it on GitHub https://github.com/Azure/azure-iot-cli-extension/issues/523#issuecomment-1155536757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH54T2TQXXTZGZO54OGZ4ULVPDEHXANCNFSM5YCBSNTQ . You are receiving this because you authored the thread.Message ID: @.***>