How to import Azure BlobService in python?

user3664942 picture user3664942 · Feb 22, 2016 · Viewed 19.3k times · Source

We are able to import azure.storage, but not access the BlobService attribute

The documentation says to use the following import statement:

from azure.storage import BlobService

But that get's the following error:

ImportError: cannot import name BlobService

We tried the following:

import azure.storage
...
foo = azure.storage.BlobService(...)

But that received the following error:

AttributeError: ‘module’ object has no attribute ‘BlobService’

We also tried all of the above with "azure.storage.blob" instead of "azure.storage"

We tried updating azure-storage package but it is up to date (version 0.30.0)

We also tried uninstalling azure-storage and installing the entire azure package, but we got the same results. We tried installing them with both pip and conda, but same results both times.

I am aware that the output suggests that this version of azure.storage has no BlobService attribute, but the documentation clearly states to import from there.

https://azure.microsoft.com/en-us/documentation/articles/machine-learning-data-science-create-features-blob/

Answer

Lily_user4045 picture Lily_user4045 · Feb 24, 2016

If you want to use BlobService, you could install package azure.storage 0.20.0, there is BlobService in that version. In the latest azure.storage 0.30.0 , BlobSrvice is split into BlockBlobService, AppendBlobService, PageBlobService object, you could use BlockBlobService replace BlobService.