Azure / azure-cli

Azure Command-Line Interface
MIT License
3.91k stars 2.88k forks source link

The command failed with an unexpected error. Here is the traceback: No module named 'azure.communication' #24453

Open FullStackSteve opened 1 year ago

FullStackSteve commented 1 year ago

Related command

az communication chat thread list

Describe the bug After installing az cli via brew and the azure communication extension via az extension add --name communication, the following error occurs when I attempt to list all threads via az communication chat thread list:

The command failed with an unexpected error. Here is the traceback:
No module named 'azure.communication'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/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/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 112, in handler
    client = self.client_factory(self.cli_ctx, command_args) if self.client_factory else None
  File "/Users/steve/.azure/cliextensions/communication/azext_communication/manual/_client_factory.py", line 55, in cf_communication_chat
    from azure.communication.chat import ChatClient, CommunicationTokenCredential
ModuleNotFoundError: No module named 'azure.communication'

To Reproduce

  1. Install az brew update &&brew install az-cli
  2. Authenticate to Azure via az-login
  3. Install communication extension via az extension add --name communication
  4. Run command az communication chat thread list
  5. See error

Expected behavior Should be able to list chat threads

Environment summary

core 2.41.0 telemetry 1.0.8

Extensions: communication 1.3.0

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


- OS version: `macOS Monterey 12.6`
- Shell Type `zsh` 

**Additional context**
ghost commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.

yonzhan commented 1 year ago

route to CXP team

FullStackSteve commented 1 year ago

FYI - the issue did not re-occur on when running the command on Ubuntu via docker with x86_64 emulation - could the issue be due to the M1 Macbook chip?

I was able to run the command successfully via the following:

docker run --platform linux/x86_64 -t -i ubuntu /bin/bash
apt-get update && apt-get install curl
curl -sL https://aka.ms/InstallAzureCLIDeb | bash
az login 
az extension add --name communication
az communication chat thread list --verbose --endpoint [redacted] --access-token [redacted]
Buzunda commented 1 year ago

I have the same issue on OSX without the M1 chip

nellyk commented 1 year ago

I'm currently having the same issue running on Apple M1 using MacOS Ventura version 13.2 azure-cli v2.45.0 with the communication v1.5.1

@PramodValavala-MSFT might you have a solution for this, happy to help with replicating the problem

Looks like a similar issue was reported https://github.com/Azure/azure-cli/issues/23500#issuecomment-1228522245 but no resolution was shared