I recently cloned a Django project of mine in a brand new machine, and went about setting up its dependencies. One such dependency was azure storages, for which I followed the advice here and simply did sudo pip install azure
.
However, upon `python manage.py syncdb', I keep getting the error:
ImportError: No module named azure.storage.blob
I've tried to solely do sudo pip install azure-storage
as well, but this doesn't alleviate my problem either. This shouldn't have been this problematic. What do I do?
The BlobServiceClient allows you to manipulate Azure Storage service resources and blob containers. The storage account provides the top-level namespace for the Blob service.
As I know, this issue is due to the version of azure storage client library for python.The old version has only one blobservice.py file and the newest splits it into three files such as blockblobservice.py, pageblobservice.py and appendblobservice.py. So, if you want to use BlockBlobService, you could install azure-storage 0.33.0.
The following steps help you to install azure-storage 0.33.0.
1.You could check the version using pip:
#pip freeze
2.If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
#pip uninstall azure
3.Install azure-storage 0.33.0
#pip install --upgrade azure-storage
You may encounter some error about cryptography, you could run the following command to solve it.
#yum install gcc libffi-devel python-devel openssl-devel
#pip install cryptography
The references:
https://pypi.python.org/pypi/azure-storage
Failed to install Python Cryptography package with PIP and setup.py
Hope it helps. Any concerns, please feel free to let me know.
In my case my file where I was using the statement
from azure.storage.blob import BlobServiceClient
was residing inside azure folder and filename was azure.py too.
After renaming the folder and file, it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With