Reputation: 15824
When I try to do python manage.py syncdb
in my Django app, I get the error ImportError: No module named azure.storage.blob. But thing is, the following packages are installed if one does pip freeze
:
azure-common==1.0.0
azure-mgmt==0.20.1
azure-mgmt-common==0.20.0
azure-mgmt-compute==0.20.0
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.1
azure-storage==0.20.3
Clearly azure-storage is installed, as is evident. Why is azure.storage.blob not available for import? I even went into my .virtualenvs
directory, and got in all the way to azure.storage.blob
(i.e. ~/.virtualenvs/myvirtualenv/local/lib/python2.7/site-packages/azure/storage/blob$
). It exists!
What do I do? This answer here has not helped: Install Azure Python api on linux: importError: No module named storage.blob
Note: please ask for more information in case you need it
Upvotes: 1
Views: 4617
Reputation:
I had a similar issue. To alleviate that, I followed this discussion here: https://github.com/Azure/azure-storage-python/issues/51#issuecomment-148151993
Basically, try pip install azure==0.11.1
before trying syncdb
, and I'm confident it will work for you!
Upvotes: 2
Reputation: 1
There is a thread similar with yours, please check my answer for the thread Unable to use azure SDK in Python.
Based on my experience, Python imports the third-party library packages from some library paths that you can check them thru codes import sys
& sys.path
in the python interpreter. So you can try to dynamically add the new path contains the installed azure
packages into the sys.path
in the Python runtime to solve the issue. For adding the new library path, you just code sys.path.append('<the new paths you want to add>')
at the front of the code like import azure
.
If the way has not helped, I suggest you can try to reinstall Python environment. On Ubuntu, you can use the command sudo apt-get remove python python-pip
& sudo apt-get install python python-pip
to reinstall Python 2.7
& pip 2.7
.(Note: The current major Linux distributions use Python 2.7 as the system default version.)
If Python 3.4 as your runtime for Django, the apt package names for Ubuntu are python3
and python3-pip
, and you can use sudo pip3 install azure
for Python 3.4
on Ubuntu.
Any concern, please feel free to let me know.
Upvotes: 0