Django-storages: Azure backend storage support fails with import error

Created on 29 Aug 2018  路  7Comments  路  Source: jschneier/django-storages

According to the docs, the way to add the azure packages is:

pip install django-storage[azure]

Which i believe should be django-storages since that package does not exist.

Either way, when i install django-storages[azure] and try to upload an image, i receive the message:

File "/usr/local/lib/python2.7/site-packages/storages/backends/azure_storage.py", line 26, in <module>
    from azure.storage import BlobService
ImportError: cannot import name 'BlobService'

It seems that BlobStorage was split in two in later releases, so in order to make it work with django-storages, it is required to install a fixed version

pip install azure-storage==0.20.0

As seen in https://github.com/wal-e/wal-e/issues/358

azure

Most helpful comment

This worked for me, adding these 2 lines in our requirements.txt:

-e git://github.com/jschneier/django-storages.git#egg=django-storages
azure-storage

the issue using the django-storages[azure] is that download all the azure libraries for python and for storage we only need azure-storage.

All 7 comments

@jroeland Those instructions are for the latest (not released yet). Try installing from master. Azure was not well supported in 1.6.

This worked for me!

pip install -e git+https://github.com/jschneier/django-storages.git#egg=django-storages[azure,google]

@sww314 I failed to notice that, thanks! :)

This worked for me, adding these 2 lines in our requirements.txt:

-e git://github.com/jschneier/django-storages.git#egg=django-storages
azure-storage

the issue using the django-storages[azure] is that download all the azure libraries for python and for storage we only need azure-storage.

@oespirilla

I get ModuleNotFoundError: No module named 'azure.storage.common' with that solution? Maybe something else I'm doing wrong?

@ckcollab make sure you don't have older version of azure storage, try using:
azure-storage>=0.36.0

i've tried in a clean environment and it worked.

Even mine is the same problem from azure.common import AzureMissingResourceHttpError ModuleNotFoundError: No module named 'azure.common' and I tried all the previous solution but didn't work. Only if I download using pipenv it works. But i have some other libraries dlib which is not installing in pipenv so what is the solution?
@oespirilla

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chickahoona picture chickahoona  路  6Comments

jonashaag picture jonashaag  路  4Comments

AGASS007 picture AGASS007  路  7Comments

ryanovas picture ryanovas  路  6Comments

david-alejandro-reyes-milian picture david-alejandro-reyes-milian  路  8Comments