Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named azure.storage.blob (when doing syncdb)

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?

like image 802
Hassan Baig Avatar asked Sep 08 '16 06:09

Hassan Baig


People also ask

What is BlobServiceClient?

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.


2 Answers

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. enter image description here

#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.

like image 76
johnny Avatar answered Nov 08 '22 17:11

johnny


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.

like image 36
ddlr Avatar answered Nov 08 '22 18:11

ddlr