8

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?

2

4 Answers 4

14

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.

13

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.

2
  • 1
    thanks! that was exactly my issue! Commented Dec 13, 2021 at 14:04
  • 1
    Same issue here! Thanks! Commented Sep 12, 2023 at 13:34
4

Ubuntu 16.04TLS + Python 3.5 Nothing worked for me, however after some fiddling...

sudo pip3 uninstall -y $(pip3 freeze | grep azure)
sudo rm /home/YOUR_ACCOUNT/.local/python3.5/site-packages/azu* -r

sudo pip3 install --upgrade requests 
sudo pip3 install azure-storage-blob
1

You cant use 'pip install azure' instead use the following commends:

pip install azure.storage.blob

and you might need:

pip install azure-storage-file-share
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.