Azure-sdk-for-python: ModuleNotFoundError: No module named 'azure.common'

Created on 23 Oct 2017  路  4Comments  路  Source: Azure/azure-sdk-for-python

Hi,
I am trying to write simple python script with Azure SDK:

import os
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
...

but I get the following error:

Traceback (most recent call last):
  File "/Users/user1/IdeaProjects/project1/main.py", line 5, in <module>
    from azure.common.credentials import ServicePrincipalCredentials
ModuleNotFoundError: No module named 'azure.common'

Process finished with exit code 1

but:

pip list|grep azure
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
azure (2.0.0)
azure-batch (3.0.0)
azure-common (1.1.8)
azure-datalake-store (0.0.17)
azure-graphrbac (0.30.0)
azure-keyvault (0.3.7)
azure-mgmt (1.0.0)
azure-mgmt-authorization (0.30.0)
azure-mgmt-batch (4.0.0)
azure-mgmt-cdn (0.30.3)
azure-mgmt-cognitiveservices (1.0.0)
azure-mgmt-common (0.20.0)
azure-mgmt-compute (1.0.0)
azure-mgmt-containerregistry (0.2.1)
azure-mgmt-datalake-analytics (0.1.6)
azure-mgmt-datalake-nspkg (2.0.0)
azure-mgmt-datalake-store (0.1.6)
azure-mgmt-devtestlabs (2.0.0)
azure-mgmt-dns (1.0.1)
azure-mgmt-documentdb (0.1.3)
azure-mgmt-iothub (0.2.2)
azure-mgmt-keyvault (0.31.0)
azure-mgmt-logic (2.1.0)
azure-mgmt-monitor (0.2.1)
azure-mgmt-network (1.0.0)
azure-mgmt-nspkg (2.0.0)
azure-mgmt-rdbms (0.1.0)
azure-mgmt-redis (4.1.0)
azure-mgmt-resource (1.1.0)
azure-mgmt-scheduler (1.1.3)
azure-mgmt-sql (0.5.3)
azure-mgmt-storage (1.0.0)
azure-mgmt-trafficmanager (0.30.0)
azure-mgmt-web (0.32.0)
azure-nspkg (2.0.0)
azure-servicebus (0.21.1)
azure-servicefabric (5.6.130)
azure-servicemanagement-legacy (0.20.6)
azure-storage (0.34.3)
msrestazure (0.4.15)

I am using pip 9.0.1.

ARM Packaging Service Attention Waiting answer question

Most helpful comment

I have re-created the venv and now it is working fine.

All 4 comments

Did you update from a previously existing venv? See this disclaimer in the ChangeLog:
https://github.com/Azure/azure-sdk-for-python/blob/38b3ce0fe3fdd6dd1e607627c611b8a9c97c2372/ChangeLog.rst#2017-05-16-azure-200

You should re-install on a fresh venv.

If you can't (i.e. system install), force a reinstall of azure-nspkg:
pip install -I azure-nspkg

I have re-created the venv and now it is working fine.

Okay, you know what, for me what worked is clear all azure thing related:

sudo pip uninstall -y $(pip freeze | grep azure)
and reinstall again:
sudo pip install azure

When pip wants to annoy you, delete all dependencies and reinstall :)

Had the same problem on Windows 10 using anaconda 3.
To recreate the problem create a new environment and either

  • pip install azure
  • conda install azure

To solve the problem
remove the package again withpip uninstall azure or conda uninstall azure
then python -m pip install --upgrade pip
and pip install azure

Seems like pip 10.0 didn't download the right package.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AmudhaPalani picture AmudhaPalani  路  4Comments

dmurnane picture dmurnane  路  3Comments

Fajkowsky picture Fajkowsky  路  4Comments

ctercekcsc picture ctercekcsc  路  4Comments

ntzhong picture ntzhong  路  3Comments