Closed stevengum closed 5 years ago
I should note that after the failed setup, executing az webapp -h
results in the following stack trace and ModuleNotFoundError
:
The command failed with an unexpected error. Here is the traceback:
No module named 'azure.mgmt'
Traceback (most recent call last):
File "C:\Users\stgum\tools\carlos-fork\venv\s58\lib\site-packages\knack\cli.py", line 206, in invoke
cmd_result = self.invocation.execute(args)
File "c:\users\stgum\tools\carlos-fork\src\azure-cli-core\azure\cli\core\commands\__init__.py", line 273, in execute
parsed_args = self.parser.parse_args(args)
File "C:\Users\stgum\tools\carlos-fork\venv\s58\lib\site-packages\knack\parser.py", line 256, in parse_args
return super(CLICommandParser, self).parse_args(args)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1749, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1781, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1969, in _parse_known_args
positionals_end_index = consume_positionals(start_index)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1946, in consume_positionals
take_action(action, args)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1855, in take_action
action(self, namespace, argument_values, option_string)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1152, in __call__
subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1781, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1987, in _parse_known_args
start_index = consume_optional(start_index)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1927, in consume_optional
take_action(action, args, option_string)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1855, in take_action
action(self, namespace, argument_values, option_string)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1037, in __call__
parser.print_help()
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 2474, in print_help
self._print_message(self.format_help(), file)
File "c:\users\stgum\tools\carlos-fork\src\azure-cli-core\azure\cli\core\parser.py", line 156, in format_help
super(AzCliCommandParser, self).format_help()
File "C:\Users\stgum\tools\carlos-fork\venv\s58\lib\site-packages\knack\parser.py", line 246, in format_help
is_group)
File "c:\users\stgum\tools\carlos-fork\src\azure-cli-core\azure\cli\core\_help.py", line 148, in show_help
super(AzCliHelp, self).show_help(cli_name, nouns, parser, is_group)
File "C:\Users\stgum\tools\carlos-fork\venv\s58\lib\site-packages\knack\help.py", line 664, in show_help
else self.group_help_cls(self, delimiters, parser)
File "C:\Users\stgum\tools\carlos-fork\venv\s58\lib\site-packages\knack\help.py", line 219, in __init__
child.load(options)
File "c:\users\stgum\tools\carlos-fork\src\azure-cli-core\azure\cli\core\_help.py", line 242, in load
loader.versioned_load(self, options)
File "c:\users\stgum\tools\carlos-fork\src\azure-cli-core\azure\cli\core\_help_loaders.py", line 153, in versioned_load
super(CliHelpFile, help_obj).load(parser) # pylint:disable=bad-super-call
File "C:\Users\stgum\tools\carlos-fork\venv\s58\lib\site-packages\knack\help.py", line 163, in load
description = getattr(options, 'description', None)
File "C:\Users\stgum\tools\carlos-fork\venv\s58\lib\site-packages\knack\parser.py", line 237, in __getattribute__
if callable(self._description) else self._description
File "c:\users\stgum\tools\carlos-fork\src\azure-cli-core\azure\cli\core\__init__.py", line 460, in default_description_loader
op = handler or self.get_op_handler(operation, operation_group=kwargs.get('operation_group'))
File "c:\users\stgum\tools\carlos-fork\src\azure-cli-core\azure\cli\core\__init__.py", line 494, in get_op_handler
op = import_module(mod_to_import)
File "C:\Users\stgum\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\users\stgum\tools\carlos-fork\src\command_modules\azure-cli-appservice\azure\cli\command_modules\appservice\custom.py", line 33, in <module>
from azure.mgmt.storage import StorageManagementClient
ModuleNotFoundError: No module named 'azure.mgmt'
To open an issue, please run: 'az feedback'
@lmazuel, @tjprescott any ideas? I noticed in the dev_setup.py it force installs the old azure-mgmt-nspkg to use the old style namespace...
# Ensure that the site package's azure/__init__.py has the old style namespace
# package declaration by installing the old namespace package
pip_command('install --force-reinstall azure-nspkg==1.0.0')
pip_command('install --force-reinstall azure-mgmt-nspkg==1.0.0')
Looks like this is related #9046.
Thanks for linking that @tjprescott, downgrading pip to 9.0.1 via pip install --upgrade pip==9.0.1
got rid of the error messages and problems when directly calling a command module (e.g. az webapp -h
).
@stevengum instead of using scripts\dev_setup.py does it work if you do the following:
create and activate new venv
pip install azdev
azdev setup -c
That worked, I tested running a couple of commands, the linter and recorded tests. Everything seems to be working great 👍
If dev_setup.py is broken, can you please remove it or update it to point to the new method?
We will remove it in the future, but we have already updated our documentation to point to the new tooling: https://github.com/Azure/azure-cli/blob/dev/doc/configuring_your_machine.md
I will note though that I did use dev_setup.py
with the updated pip and it worked for me still.
Understood, but I am sure that Steven and I will not be the only folks who run into this. A helpful note will save time.
Describe the bug Incompatible name space package requirements (
azure-mgmt-nspkg
) when running dev_setup script.To Reproduce
scripts/dev_setup.py
@tjprescott, @williexu
Additional context Python 3.7.0
Output of
pip freeze
: