Azure / azure-cli-extensions

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

ModuleNotFoundError: No module named 'azure.communication' in Mac M2 #6333

Closed victor-gm closed 1 year ago

victor-gm commented 1 year ago

Related command

az communication email send --sender "[filled]" --subject "Contoso Update" --to "[filled]" --text "Hello valued client. There is an update."

Extension name (the extension in question)

communication

Description of issue (in as much detail as possible)

Tried to send an email following https://learn.microsoft.com/es-es/cli/azure/communication/email?view=azure-cli-latest and get:

Error

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.49.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.49.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.49.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.49.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.49.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.49.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/***/.azure/cliextensions/communication/azext_communication/manual/_client_factory.py", line 85, in cf_communication_email
    from azure.communication.email import EmailClient
ModuleNotFoundError: No module named 'azure.communication'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Azure CLi Version

azure-cli                         2.49.0

core                              2.49.0
telemetry                          1.0.8

Extensions:
communication                      1.5.2

Dependencies:
msal                              1.20.0
azure-mgmt-resource               22.0.0

Python location '/opt/homebrew/Cellar/azure-cli/2.49.0/libexec/bin/python'
Extensions directory '/Users/***/.azure/cliextensions'

Python (Darwin) 3.10.11 (main, Apr  7 2023, 07:24:53) [Clang 14.0.0 (clang-1400.0.29.202)]

To Reproduce

Run

az communication email send --sender "[filled]" --subject "Contoso Update" --to "[filled]"  --text "Hello valued client. There is an update."

Environment Summary

HOMEBREW_VERSION: 4.0.19-24-ge96fd24
ORIGIN: https://github.com/Homebrew/brew
HEAD: e96fd24a7328a4913de2f7c56fd2c97d9aaa4572
Last commit: 2 days ago
Core tap JSON: 26 May 20:32 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 14.0.3 build 1403
Git: 2.39.2 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.87.0 => /usr/bin/curl
macOS: 13.3.1-arm64
CLT: 14.3.0.0.1.1679647830
Xcode: 14.3
Rosetta 2: false

Tried solutions

pip3 install azure-communication-email
yonzhan commented 1 year ago

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

ghost commented 1 year ago

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

navba-MSFT commented 1 year ago

@victor-gm Apologies for the late reply. Thanks for reaching out to us and reporting this issue.

Please run the below command in order:

pip3 uninstall azure-communication-email

pip3 install azure-communication-email==1.0.0

pip3 install azure-communication-administration

Please let me know if you still see the same issue after following the above plan.

navba-MSFT commented 1 year ago

@victor-gm I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know if you had any updates on this. Awaiting your reply.

navba-MSFT commented 1 year ago

@victor-gm The action is pending on you to try the above suggestions. If you need any further assistance on this issue in future, please feel free to reopen this thread. We would be happy to help.

BenedekKoncz commented 1 year ago

@yonzhan was this ever solved? Same issue here with these versions.

az --version azure-cli 2.50.0

core 2.50.0 telemetry 1.0.8

Extensions: aks-preview 0.5.146 communication 1.7.0b1 resource-mover 0.1.1 ssh 2.0.0

Dependencies: msal 1.22.0 azure-mgmt-resource 23.1.0b2

sarathkrishnan-007 commented 7 months ago

The same fails in MacOS (Intel) as well. The command failed with an unexpected error. Here is the traceback: No module named 'azure.communication'

When I installed the extension, it installed without complaining, but doesn't recognise the module azure-cli 2.57.0

core 2.57.0 telemetry 1.1.0

Extensions: account 0.2.2 azure-devops 0.18.0 communication 1.8.0b1 costmanagement 0.2.1 reservation 0.3.0 storage-blob-preview 0.7.2 storage-preview 1.0.0b1

Dependencies: msal 1.26.0 azure-mgmt-resource 23.1.0b2

ethanbayliss commented 3 months ago

Still an issue for me

$ az communication email send --sender $sender \
>                             --subject test \
>                             --cc test@email.com \
>                             --text "body" \
>                             --to $recipient
The command failed with an unexpected error. Here is the traceback:
No module named 'azure.communication'
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.60.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.60.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/ethan.bayliss/.azure/cliextensions/communication/azext_communication/manual/_client_factory.py", line 85, in cf_communication_email
    from azure.communication.email import EmailClient
ModuleNotFoundError: No module named 'azure.communication'
pip3 list
Package      Version
------------ --------
certifi      2024.2.2
cffi         1.16.0
cryptography 42.0.7
pip          24.0
pycparser    2.22
wheel        0.43.0
az --version
azure-cli                         2.60.0

core                              2.60.0
telemetry                          1.1.0

Extensions:
communication                      1.9.2
resource-graph                     2.1.0

Dependencies:
msal                              1.28.0
azure-mgmt-resource             23.1.0b2

Python location '/usr/local/Cellar/azure-cli/2.60.0/libexec/bin/python'
Extensions directory '/Users/ethan.bayliss/.azure/cliextensions'

Python (Darwin) 3.11.9 (main, Apr  2 2024, 08:25:04) [Clang 15.0.0 (clang-1500.3.9.4)]

Legal docs and information: aka.ms/AzureCliLegal
brew list
==> Formulae
aom             gnutls              librsvg             openssl@1.1
argocd              go@1.16             libslirp            openssl@3
auth0               gradle              libssh              p11-kit
autoconf            graphite2           libtasn1            packer
aws-iam-authenticator       graphviz            libtiff             pango
azure-cli           grep                libtool             parallel
azure-functions-core-tools@3    gts             libunistring            pcre2
bash                harfbuzz            libusb              pinentry
bash-completion@2       helm                libuv               pipenv
brotli              highway             libvmaf             pixman
c-ares              httpie              libx11              pkg-config
ca-certificates         icu4c               libxau              pycparser
cairo               imath               libxcb              pyenv
capstone            iproute2mac         libxdmcp            python-certifi
certifi             isl             libxext             python-cryptography
cffi                jasper              libxrender          python@3.11
colima              jless               lima                python@3.12
cryptography            jpeg-turbo          little-cms2         qemu
devcontainer            jpeg-xl             lz4             readline
docker-credential-helper-ecr    jq              lzo             redis
docutils            keyring             m4              snappy
dtc             krb5                md5sha1sum          sqlite
eksctl              kube-capacity           mongosh             step
fontconfig          kubeaudit           mpdecimal           telnet
freetype            kubelogin           mpfr                tfenv
fribidi             kubernetes-cli          ncurses             unbound
gcc             kustomize           netpbm              vde
gd              libassuan           nettle              watch
gdk-pixbuf          libavif             node                webp
gettext             libevent            node@16             wget
gh              libgcrypt           npth                xorgproto
giflib              libgpg-error            nvm             xz
git             libidn2             oniguruma           yarn
git-crypt           libksba             openexr             ykman
glib                libmpc              openjdk             yq
gmp             libnghttp2          openjdk@11          zstd
gnu-sed             libpng              openjdk@17
gnupg               libpq               openldap

==> Casks
1password-cli           dbeaver-community       microsoft-remote-desktop    powershell