azure-cli macOS homebrew No module named 'azure.mgmt.compute'

Created on 13 Oct 2018  Â·  15Comments  Â·  Source: Azure/azure-cli

Describe the bug
az vm list fails with "ModuleNotFoundError: No module named 'azure.mgmt.compute'"

To Reproduce
Install azure-cli via home-brew on Mac
Login via az login
List VMs: az vm list --debug

No module named 'azure.mgmt.compute'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/knack/cli.py", line 197, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 262, in execute
self.commands_loader.load_arguments(command)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 254, in load_arguments
loader.load_arguments(command) # this adds entries to the argument registries
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/__init__.py", line 32, in load_arguments
load_arguments(self, command)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/_params.py", line 27, in load_arguments
from azure.mgmt.compute.models import CachingTypes, UpgradeMode
ModuleNotFoundError: No module named 'azure.mgmt.compute'

Expected behavior
List virtual Machines?

Environment summary
Installed via Homebrew 1.7.7
OSX 10.13.6
azure-cli (2.0.47)

acr (2.1.6)
acs (2.3.6)
advisor (0.6.0)
ams (0.2.3)
appservice (0.2.5)
backup (1.2.1)
batch (3.4.0)
batchai (0.4.3)
billing (0.2.0)
botservice (0.1.1)
cdn (0.1.1)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.5)
core (2.0.47)
cosmosdb (0.2.1)
dla (0.2.3)
dls (0.1.3)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.0)
extension (0.2.2)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.3.30)
iot (0.3.3)
iotcentral (0.1.2)
keyvault (2.2.4)
lab (0.1.1)
maps (0.3.2)
monitor (0.2.4)
network (2.2.6)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.4)
role (2.1.7)
search (0.1.1)
servicebus (0.3.0)
servicefabric (0.1.4)
signalr (1.0.0)
sql (2.1.4)
storage (2.2.2)
telemetry (1.0.0)
vm (2.2.4)

Python location '/usr/local/opt/python/bin/python3.7'
Extensions directory '/Users/ericgulatee/.azure/cliextensions'

Python (Darwin) 3.7.0 (default, Oct 2 2018, 09:20:07)
[Clang 10.0.0 (clang-1000.11.45.2)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

PackaginHomebrew

Most helpful comment

Fix confirmed!
ran brew upgrade azure-cli to update

All 15 comments

The same error appears for az disk list.

To Reproduce
Install azure-cli via home-brew on Mac
Login via az login
List Disks: az disk list

No module named 'azure.mgmt.compute'
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/knack/cli.py", line 197, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 262, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 254, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries
  File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/__init__.py", line 32, in load_arguments
    load_arguments(self, command)
  File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/_params.py", line 27, in load_arguments

Expected behavior
List managed Disks

Environment summary
Installed via Homebrew 1.7.7
OSX 10.12.6
azure-cli (2.0.47)

atk 2.18.0_1
autoconf 2.69
automake 1.15
avrdude 6.3
azure-cli 2.0.47
cairo 1.14.12 1.14.6_1 1.14.8
cmake 3.4.3 3.5.2
djvu2pdf 0.9.2
djvulibre 3.5.27
ext4fuse 0.1.3
fontconfig 2.11.1_2 2.12.1_2 2.13.1
freetype 2.6.3 2.6.5 2.7 2.7.1 2.9.1
fribidi 1.0.5
gcc 6.3.0_1
gdbm 1.12 1.18
gdk-pixbuf 2.32.3
gettext 0.19.7 0.19.8.1
ghostscript 9.19
glib 2.46.2 2.48.1 2.48.2 2.52.0 2.58.0
gmp 6.1.2
gobject-introspection 1.46.0_1 1.48.0
graphite2 1.3.12
gsettings-desktop-schemas 3.18.1
gtk+ 2.24.30
gtk+3 3.18.9
gtk-mac-integration 2.0.8
harfbuzz 1.2.6 1.8.8
hicolor-icon-theme 0.15
icu4c 57.1 58.2 62.1
ipython 6.5.0
isl 0.18
jpeg 8d
libelf 0.8.13_1
libepoxy 1.3.1
libffi 3.0.13 3.2.1
libftdi0 0.20
libmpc 1.0.3
libpng 1.6.23 1.6.25 1.6.29 1.6.35
libtiff 4.0.6_1 4.0.6_2 4.0.7_2
libtool 2.4.6 2.4.6_1
libusb 1.0.20
libusb-compat 0.1.5
libxml2 2.9.3
libyaml 0.1.6_1
little-cms2 2.7 2.8
mpfr 3.1.5
node 7.9.0
openjpeg 2.1.2
openssl 1.0.2g 1.0.2h_1 1.0.2j 1.0.2k 1.0.2p
pango 1.38.1 1.42.4
pcre 8.39 8.40 8.42
pixman 0.34.0 0.34.0_1
pkg-config 0.29 0.29.1 0.29.1_1 0.29.1_2 0.29.2
poppler 0.47.0
potrace 1.13
py2cairo 1.10.0_1
pygobject 2.28.6
pygtk 2.24.0_1
python 3.7.0
r 3.3.3_1
rbenv 1.0.0
rbenv-bundler 0.99
readline 6.3.8 7.0.1 7.0.3_1 7.0.5
rrdtool 1.7.0_1
ruby 2.3.0 2.3.1
ruby-build 20160228 20160426
sqlite 3.13.0 3.15.2 3.16.2 3.24.0 3.25.2
sshfs 2.5.0
xz 5.2.2 5.2.3 5.2.4
zeromq 4.2.5

which python3                                                                               
/usr/local/bin/python3

which python
/usr/bin/python

Python 3.7.0 (default, Aug 22 2018, 15:22:56)
[Clang 9.0.0 (clang-900.0.39.2)] on darwin

Python 2.7.10 (default, Feb  7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin

eddiefrederick $az -v
azure-cli (2.0.47)

acr (2.1.6)
acs (2.3.6)
advisor (0.6.0)
ams (0.2.3)
appservice (0.2.5)
backup (1.2.1)
batch (3.4.0)
batchai (0.4.3)
billing (0.2.0)
botservice (0.1.1)
cdn (0.1.1)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.5)
core (2.0.47)
cosmosdb (0.2.1)
dla (0.2.3)
dls (0.1.3)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.0)
extension (0.2.2)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.3.30)
iot (0.3.3)
iotcentral (0.1.2)
keyvault (2.2.4)
lab (0.1.1)
maps (0.3.2)
monitor (0.2.4)
network (2.2.6)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.4)
role (2.1.7)
search (0.1.1)
servicebus (0.3.0)
servicefabric (0.1.4)
signalr (1.0.0)
sql (2.1.4)
storage (2.2.2)
telemetry (1.0.0)
vm (2.2.4)

Python location '/usr/local/opt/python/bin/python3.7'
Extensions directory '/Users/eddiefrederick/.azure/cliextensions'

Python (Darwin) 3.7.0 (default, Oct 2 2018, 09:18:58)
[Clang 10.0.0 (clang-1000.11.45.2)]

Legal docs and information: aka.ms/AzureCliLegal

eddiefrederick $which python3
/usr/local/bin/python3

eddiefrederick $which python
/usr/local/bin/python
eddiefrederick $

Python location '/usr/local/opt/python/bin/python3.7'
Extensions directory '/Users/eddiefrederick/.azure/cliextensions'

Python (Darwin) 3.7.0 (default, Oct 2 2018, 09:18:58)
[Clang 10.0.0 (clang-1000.11.45.2)]

Tried all variations of brew update, install, uninstall, upgrade, etc...

eddiefrederick $az vm list
No module named 'azure.mgmt.compute'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/knack/cli.py", line 197, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 262, in execute
self.commands_loader.load_arguments(command)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 254, in load_arguments
loader.load_arguments(command) # this adds entries to the argument registries
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/__init__.py", line 32, in load_arguments
load_arguments(self, command)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/_params.py", line 27, in load_arguments
from azure.mgmt.compute.models import CachingTypes, UpgradeMode
ModuleNotFoundError: No module named 'azure.mgmt.compute'

eddiefrederick $az disk list
No module named 'azure.mgmt.compute'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/knack/cli.py", line 197, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 262, in execute
self.commands_loader.load_arguments(command)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 254, in load_arguments
loader.load_arguments(command) # this adds entries to the argument registries
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/__init__.py", line 32, in load_arguments
load_arguments(self, command)
File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/_params.py", line 27, in load_arguments
from azure.mgmt.compute.models import CachingTypes, UpgradeMode
ModuleNotFoundError: No module named 'azure.mgmt.compute'

Me too :( same error.

Also just encountered this issue.

None of the troubleshooting commands have resolved it either:

  • brew update && brew install python3 && brew upgrade python3
  • brew link --overwrite python3
  • brew unlink python && brew link python
  • brew uninstall azure-cli && brew install azure-cli
  • brew doctor

I just got the same error as well.

No module named 'azure.mgmt.compute' Traceback (most recent call last): File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/knack/cli.py", line 197, in invoke cmd_result = self.invocation.execute(args) File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 262, in execute self.commands_loader.load_arguments(command) File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 254, in load_arguments loader.load_arguments(command) # this adds entries to the argument registries File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/__init__.py", line 32, in load_arguments load_arguments(self, command) File "/usr/local/Cellar/azure-cli/2.0.47/libexec/lib/python3.7/site-packages/azure/cli/command_modules/vm/_params.py", line 27, in load_arguments from azure.mgmt.compute.models import CachingTypes, UpgradeMode ModuleNotFoundError: No module named 'azure.mgmt.compute'

I think it is a well-known issue:

OS: MacOS Mojave 10.14

azure-cli (2.0.47)

acr (2.1.6)
acs (2.3.6)
advisor (0.6.0)
ams (0.2.3)
appservice (0.2.5)
backup (1.2.1)
batch (3.4.0)
batchai (0.4.3)
billing (0.2.0)
botservice (0.1.1)
cdn (0.1.1)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.5)
core (2.0.47)
cosmosdb (0.2.1)
dla (0.2.3)
dls (0.1.3)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.0)
extension (0.2.2)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.3.30)
iot (0.3.3)
iotcentral (0.1.2)
keyvault (2.2.4)
lab (0.1.1)
maps (0.3.2)
monitor (0.2.4)
network (2.2.6)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.4)
role (2.1.7)
search (0.1.1)
servicebus (0.3.0)
servicefabric (0.1.4)
signalr (1.0.0)
sql (2.1.4)
storage (2.2.2)
telemetry (1.0.0)
vm (2.2.4)

Python location '/usr/local/opt/python/bin/python3.7'
Extensions directory '/Users/smithm/.azure/cliextensions'

Python (Darwin) 3.7.0 (default, Oct 2 2018, 09:18:58)
[Clang 10.0.0 (clang-1000.11.45.2)]

Legal docs and information: aka.ms/AzureCliLegal

I just tried my script on a High Sierra machine. Same result.

Was having the same issue, fixed mine by installing azure-cli using pip instead of homebrew.

I think it is a well-known issue:

OS: MacOS Mojave 10.14

azure-cli (2.0.47)

acr (2.1.6)
acs (2.3.6)
advisor (0.6.0)
ams (0.2.3)
appservice (0.2.5)
backup (1.2.1)
batch (3.4.0)
batchai (0.4.3)
billing (0.2.0)
botservice (0.1.1)
cdn (0.1.1)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.5)
core (2.0.47)
cosmosdb (0.2.1)
dla (0.2.3)
dls (0.1.3)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.0)
extension (0.2.2)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.3.30)
iot (0.3.3)
iotcentral (0.1.2)
keyvault (2.2.4)
lab (0.1.1)
maps (0.3.2)
monitor (0.2.4)
network (2.2.6)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.4)
role (2.1.7)
search (0.1.1)
servicebus (0.3.0)
servicefabric (0.1.4)
signalr (1.0.0)
sql (2.1.4)
storage (2.2.2)
telemetry (1.0.0)
vm (2.2.4)

Python location '/usr/local/opt/python/bin/python3.7'
Extensions directory '/Users/smithm/.azure/cliextensions'

Python (Darwin) 3.7.0 (default, Oct 2 2018, 09:18:58)
[Clang 10.0.0 (clang-1000.11.45.2)]

Legal docs and information: aka.ms/AzureCliLegal

Install Azure-Cli 2.0.46 and it work!!! So I can confirm that the problem of dependencies configuration on 2.0.47 file.

So how do I install an older version of the cli with home brew? I tried by referencing brew install azure-cli@(legacy version number here) and it wouldn’t work. I’m somewhat of a noob with brew so likely user error.

Sent from my iPhone
Eddie Frederick
c: 1-865-438-3179 | p: 1-888-400-1451 x1048

ministrybrands.com

On Oct 15, 2018, at 11:46 PM, SmithMMTK <[email protected]notifications@github.com> wrote:

I think it is a well-known issue:

OS: MacOS Mojave 10.14

azure-cli (2.0.47)

acr (2.1.6)
acs (2.3.6)
advisor (0.6.0)
ams (0.2.3)
appservice (0.2.5)
backup (1.2.1)
batch (3.4.0)
batchai (0.4.3)
billing (0.2.0)
botservice (0.1.1)
cdn (0.1.1)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.5)
core (2.0.47)
cosmosdb (0.2.1)
dla (0.2.3)
dls (0.1.3)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.0)
extension (0.2.2)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.3.30)
iot (0.3.3)
iotcentral (0.1.2)
keyvault (2.2.4)
lab (0.1.1)
maps (0.3.2)
monitor (0.2.4)
network (2.2.6)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.4)
role (2.1.7)
search (0.1.1)
servicebus (0.3.0)
servicefabric (0.1.4)
signalr (1.0.0)
sql (2.1.4)
storage (2.2.2)
telemetry (1.0.0)
vm (2.2.4)

Python location '/usr/local/opt/python/bin/python3.7'
Extensions directory '/Users/smithm/.azure/cliextensions'

Python (Darwin) 3.7.0 (default, Oct 2 2018, 09:18:58)
[Clang 10.0.0 (clang-1000.11.45.2)]

Legal docs and information: aka.ms/AzureCliLegalhttp://aka.ms/AzureCliLegal

Install Azure-Cli 2.0.46 and it work!!! So I can confirm that the problem of dependencies configuration on 2.0.47 file.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-cli/issues/7559#issuecomment-430090749, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhDJCGy-EEi5XKqzEEMMnIGuDlwYzqGjks5ulVaGgaJpZM4XacW9.

So how do I install an older version of the cli with home brew? I tried by referencing brew install azure-cli@(legacy version number here) and it wouldn’t work. I’m somewhat of a noob with brew so likely user error.
…

Copy & Paste following command:

brew unlink azure-cli

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/3894a0d2095f48136ce1af5ebd5ba42dd38f1dac/Formula/azure-cli.rb

reference: https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula

The failure is due to an issue with the way azure-mgmt-compute 4.3.0 is packaged. A fix is forthcoming but for now, the recommended solution would be to install azure-cli 2.0.46 using the commands provided by @SmithMMTK.

Once merged, this should fix the issue: https://github.com/Homebrew/homebrew-core/pull/33054

The homebrew formula has been merged. Please run brew reinstall azure-cli and your issue should be fixed.

Fix confirmed!
ran brew upgrade azure-cli to update

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cicorias picture cicorias  Â·  3Comments

Kannaj picture Kannaj  Â·  3Comments

binderjoe picture binderjoe  Â·  3Comments

rlewkowicz picture rlewkowicz  Â·  3Comments

amarzavery picture amarzavery  Â·  3Comments