Azure / azure-iot-cli-extension

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

ImportError: cannot import name 'c_uamqp' from partially initialized module 'uamqp' (most likely due to a circular import) #501

Closed Girirajh closed 2 years ago

Girirajh commented 2 years ago

Describe the bug

Command Name az iot device c2d-message send 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/giri/.azure/cliextensions/azure-iot/uamqp/__init__.py)
Traceback (most recent call last):
  File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/home/giri/.azure/cliextensions/azure-iot/azext_iot/operations/hub.py", line 2513, in iot_c2d_message_send
    from azext_iot.monitor import event
  File "/home/giri/.azure/cliextensions/azure-iot/azext_iot/monitor/event.py", line 8, in <module>
    import uamqp
  File "/home/giri/.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/giri/.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-1072-azure-x86_64-with-glibc2.28 (Cloud Shell), Common Base Linux Delridge (quinault)
Python 3.8.12
Installer: DEB

azure-cli 2.34.1

Extensions:
azure-iot 0.13.0
ai-examples 0.2.5
ssh 1.0.0

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Additional Context

digimaun commented 2 years ago

Hi @Girirajh, please try appending --repair to the command to force a re-install of uamqp. Several other users had this issue and forcing reinstall of uamqp through --repair worked.

vilit1 commented 2 years ago

Closing since this is the same issue as https://github.com/Azure/azure-iot-cli-extension/issues/465