Azure-cli: No module named 'decorator' exception, fixed by installing 'decorator' package

Created on 6 May 2020  路  8Comments  路  Source: Azure/azure-cli

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az webapp list

Errors:

No module named 'decorator'
Traceback (most recent call last):
python3/dist-packages/fabric/connection.py, ln 5, in <module>
    from invoke.vendor.six import StringIO
ModuleNotFoundError: No module named 'invoke.vendor.six'

...

python3/dist-packages/fabric/connection.py, ln 10, in <module>
    from decorator import decorator
ModuleNotFoundError: No module named 'decorator'

To Reproduce:

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

  • _Put any pre-requisite steps here..._
  • az webapp list

Expected Behavior

Environment Summary

Linux-5.4.0-28-generic-x86_64-with-glibc2.29
Python 3.8.2
Shell: bash

azure-cli 2.0.81

Extensions:
azure-devops 0.17.0

Additional Context


Core Packaging

Most helpful comment

I got around this by adding the decorator package to my system python3 site-packages. I ran this:

sudo /usr/bin/pip3 install --system decorator

Should this be required? Is the Linux installation of az not fully installing all its needed dependencies?

All 8 comments

Here's the full stack-trace output:

The command failed with an unexpected error. Here is the traceback:

No module named 'decorator'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/fabric/connection.py", line 5, in <module>
    from invoke.vendor.six import StringIO
ModuleNotFoundError: No module named 'invoke.vendor.six'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 528, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 299, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 291, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/lib/python3/dist-packages/knack/commands.py", line 97, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 496, in default_arguments_loader
    op = handler or self.get_op_handler(operation, operation_group=kwargs.get('operation_group'))
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 536, in get_op_handler
    op = import_module(mod_to_import)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/appservice/custom.py", line 25, in <module>
    from fabric import Connection
  File "/usr/lib/python3/dist-packages/fabric/__init__.py", line 3, in <module>
    from .connection import Config, Connection
  File "/usr/lib/python3/dist-packages/fabric/connection.py", line 10, in <module>
    from decorator import decorator
ModuleNotFoundError: No module named 'decorator'

I got around this by adding the decorator package to my system python3 site-packages. I ran this:

sudo /usr/bin/pip3 install --system decorator

Should this be required? Is the Linux installation of az not fully installing all its needed dependencies?

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

routing to appropriate team.

@yungezz @ewh from the above comment it seems like the azure-cli package was not installed properly or the extension being used is causing some errors. I tried this on the latest azure-cli version without any extensions & it works fine. Please try a clean install without any extensions and let us know if this is still an issue.

Not specific to web apps but something to do with the packages installed during core install.

You are using an old version not from the microsoft repo. Please see instructions on updating to the latest official version: https://github.com/Azure/azure-cli/issues/14011#issue-640943121

Duplicate of #14011

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amarzavery picture amarzavery  路  3Comments

dhermans picture dhermans  路  3Comments

derekbekoe picture derekbekoe  路  3Comments

binderjoe picture binderjoe  路  3Comments

ahmetb picture ahmetb  路  3Comments