Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
383 stars 1.24k forks source link

No module named 'azure.communication' error when trying to get acs token from macbook #8074

Open dbradish-microsoft opened 8 months ago

dbradish-microsoft commented 8 months ago

Describe the bug

This bug report is being moved from MicrosoftDocs/azure-docs issue #119472. This issue seems to be related to unresolved issue #24453.

REQUEST: Please route this issue to the Azure service team and have them respond to @juliays in this new GitHub issue. The customer reports as follows:

From @juliays on Feb 2, 2024: " trying this command to get acs communication token.

az communication identity token issue --scope voip --connection-string ""

az version 2.56.0 and up to date.

Got this error below -

Command group 'az communication identity' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus 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.56.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/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.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) ^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/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/yangsong/.azure/cliextensions/communication/azext_communication/manual/_client_factory.py", line 13, in cf_communication_identity from azure.communication.identity import CommunicationIdentityClient ModuleNotFoundError: No module named 'azure.communication' "

From @dbradish-microsoft on Feb 7, 2024: " @juliays, How did you install the extension? Try using az extension add --name communication. Your error "No module named 'azure.communication'" makes me wonder if the extension is installed. "

From @juliays on Feb 7, 2024 " I ran the command below and here are the output. I have a macbook. One suggestion is that you also list the option to generate token via portal and cloudshell so ppl have a workaround when it doesn't work. Thanks!

az extension add --name communication --allow-preview true Extension 'communication' 1.8.0b1 is already installed. ➜ main git:(main) az communication identity token issue --scope voip --connection-string "connectionString" This command is implicitly deprecated because command group 'communication identity token' is deprecated and will be removed in a future release. Use 'communication user-identity token' instead. Command group 'az communication identity' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus 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.56.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/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.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) ^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/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/yangsong/.azure/cliextensions/communication/azext_communication/manual/_client_factory.py", line 13, in cf_communication_identity from azure.communication.identity import CommunicationIdentityClient ModuleNotFoundError: No module named 'azure.communication' "

Related command

az communication

Errors

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

Issue script & Debug output

Please see above

Expected behavior

The az communication module installs without error

Environment Summary

azure-cli/2.56.0/libexec/lib/python3.11

Additional context

No response

azure-client-tools-bot-prd[bot] commented 8 months ago

Hi @dbradish-microsoft,

2.56.0 is not the latest Azure CLI(2.58.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

azure-client-tools-bot-prd[bot] commented 8 months ago
Hi @dbradish-microsoft Find similar issue https://github.com/Azure/azure-cli/issues/24453.
Issue title The command failed with an unexpected error. Here is the traceback: No module named 'azure.communication'
Create time 2022-10-27
Comment number 4

Please confirm if this resolves your issue.

yonzhan commented 8 months ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 8 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @acsdevx-msft.

r-priyam commented 6 months ago

Do we have any update here, please? It's been a while!

CornerstoneII commented 5 months ago

What worked for me was adding azure-communication-identity and version to the requirements.txt file. I had tried pip install azure-communication-identity multiple times, but the error still persisted until I updated the requirements file.