0

I have this environment:

pip3 freeze | grep -i azure
azure==1.0.3
azure-batch==1.1.0
azure-common==1.1.4
azure-mgmt==0.20.2
azure-mgmt-common==0.20.0
azure-mgmt-compute==0.20.1
azure-mgmt-network==0.20.1
azure-mgmt-nspkg==1.0.0
azure-mgmt-resource==0.20.1
azure-mgmt-storage==0.20.0
azure-nspkg==1.0.0
azure-servicebus==0.20.1
azure-servicemanagement-legacy==0.20.2
azure-storage==0.33.0
msrestazure==0.4.4

I try to execute a program in python that start so:

from azure.storage.blob import BlockBlobService,ContentSettings

block_blob_service = BlockBlobService("xxx","***")

And python output this error:

Traceback (most recent call last):
  File "azure.py", line 1, in <module>
    from azure.storage.blob import BlockBlobService,ContentSettings
  File "/Users/dgonzalez/Proyectos/iloveplatos/git/back/app/azure.py", line 1, in <module>
    from azure.storage.blob import BlockBlobService,ContentSettings
ImportError: No module named 'azure.storage'; 'azure' is not a package

Any ideas, I have tested with other versions, but I have the same problem. I am blocked at this point.

Thanks!!

Oladimeji Mudele
  • 63
  • 1
  • 1
  • 5
  • Possible duplicate of [Importing installed package from script raises "AttributeError: module has no attribute" or "ImportError: cannot import name"](https://stackoverflow.com/questions/36250353/importing-installed-package-from-script-raises-attributeerror-module-has-no-at) – pppery Aug 19 '19 at 13:46

2 Answers2

4

The problem is coming from the name of your script/module which is named azure.py. Python imports it as the first one in the hierarchy. You should rename it to something else, say azure_deployment.py to avoid a name conflict with the Microsoft azure package.

Oladimeji Mudele
  • 63
  • 1
  • 1
  • 5
0

It looks like you have made your own azure.py module that is interfering with the system azure module. Name your module something else.

John Gordon
  • 29,573
  • 7
  • 33
  • 58