Azure-sdk-for-python: BlobServiceClient not available in Azure Notebooks

Created on 19 Apr 2020  路  8Comments  路  Source: Azure/azure-sdk-for-python

  • Package Name: azure-storage and azure-storage-blob
  • Package Version: 0.36.0 and 12.3.0 respectively
  • Operating System: Unknown (whichever OS Azure Notebooks is using)
  • Python Version: Whichever python version Azure Notebooks is using

Describe the bug

To Reproduce

  1. Run !pip install azure-storage --upgrade and !pip install azure-storage-blob --upgrade in an Azure Notebook
  2. Run from azure.storage.blob import BlobServiceClient (I'm trying to run these instructions to use the BlobServiceClient to interact with Azure Storage)

Expected behavior
I'd be able to configure BlobServiceClient per the instructions above

Screenshot
image

Client Storage customer-reported question

Most helpful comment

Sweeeeeeeet! After installing few missing modules (lining up my previous AN env with the clean one), I'm now able to import BlobServiceClient.
Thanks again.

All 8 comments

@SeaDude thanks for reaching out to us, someone from our team will take a look at this //cc: @rakshith91 @mayurid

Hi @SeaDude
First azure-storage is an incompatible old version of azure-storage-blob. You cannot install them at the same time, and that will create terrible conflicts.
Being default notebooks are shipped with azure-storage-blob, 2.1.0, upgrading just this one with !pip install -U azure-storage-blob should be enough.
Could you try and update this thread?
Thanks

Hi @Imazuel, thanks for the quick reply.
- I ran:

!pip uninstall azure-storage --yes
!pip install -U azure-storage-blob
from azure.storage.blob import BlobServiceClient

- Same error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-7-48fd2e1877c7> in <module>
      1 get_ipython().system('pip uninstall azure-storage --yes')
      2 get_ipython().system('pip install -U azure-storage-blob')
----> 3 from azure.storage.blob import BlobServiceClient

ImportError: cannot import name 'BlobServiceClient'

Here are the results of !pip freeze.

  • See anything that would cause a conflict?
absl-py==0.8.1
adal==1.2.2
aiohttp==3.6.2
alabaster==0.7.11
altair==3.2.0
anaconda-client==1.7.2
anaconda-navigator==1.9.2
anaconda-project==0.8.2
ansiwrap==0.8.4
antlr4-python3-runtime==4.7.2
appdirs==1.4.3
applicationinsights==0.11.9
argcomplete==1.10.0
arrow==0.15.4
asn1crypto==0.24.0
astor==0.8.0
astroid==2.0.4
astropy==3.0.4
async-timeout==3.0.1
atomicwrites==1.2.1
attrs==18.2.0
Automat==0.7.0
azure==4.0.0
azure-ai-textanalytics==1.0.0b4
azure-appconfiguration==1.0.0
azure-applicationinsights==0.1.0
azure-batch==4.1.3
azure-cli-core==2.0.54
azure-cli-nspkg==3.0.4
azure-cli-telemetry==1.0.4
azure-common==1.1.23
azure-core==1.4.0
azure-cosmosdb-nspkg==2.0.2
azure-cosmosdb-table==1.0.6
azure-datalake-store==0.0.48
azure-eventgrid==1.3.0
azure-eventhub==5.1.0b1
azure-eventhub-checkpointstoreblob==1.1.0
azure-eventhub-checkpointstoreblob-aio==1.1.0
azure-graphrbac==0.40.0
azure-identity==1.4.0b2
azure-keyvault==1.1.0
azure-keyvault-certificates==4.1.0
azure-keyvault-keys==4.1.0
azure-keyvault-secrets==4.1.0
azure-kusto-data==0.0.38
azure-kusto-ingest==0.0.38
azure-loganalytics==0.1.0
azure-mgmt==4.0.0
azure-mgmt-advisor==1.0.1
azure-mgmt-applicationinsights==0.1.1
azure-mgmt-authorization==0.50.0
azure-mgmt-batch==5.0.1
azure-mgmt-batchai==2.0.0
azure-mgmt-billing==0.2.0
azure-mgmt-cdn==3.1.0
azure-mgmt-cognitiveservices==3.0.0
azure-mgmt-commerce==1.0.1
azure-mgmt-compute==4.6.2
azure-mgmt-consumption==2.0.0
azure-mgmt-containerinstance==1.5.0
azure-mgmt-containerregistry==2.8.0
azure-mgmt-containerservice==4.4.0
azure-mgmt-cosmosdb==0.4.1
azure-mgmt-datafactory==0.6.0
azure-mgmt-datalake-analytics==0.6.0
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.5.0
azure-mgmt-datamigration==1.0.0
azure-mgmt-devspaces==0.1.0
azure-mgmt-devtestlabs==2.2.0
azure-mgmt-dns==2.1.0
azure-mgmt-eventgrid==1.0.0
azure-mgmt-eventhub==2.6.0
azure-mgmt-hanaonazure==0.1.1
azure-mgmt-iotcentral==0.1.0
azure-mgmt-iothub==0.5.0
azure-mgmt-iothubprovisioningservices==0.2.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-loganalytics==0.2.0
azure-mgmt-logic==3.0.0
azure-mgmt-machinelearningcompute==0.4.1
azure-mgmt-managementgroups==0.1.0
azure-mgmt-managementpartner==0.1.1
azure-mgmt-maps==0.1.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-media==1.0.0
azure-mgmt-monitor==0.5.2
azure-mgmt-msi==0.2.0
azure-mgmt-network==2.7.0
azure-mgmt-notificationhubs==2.1.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-policyinsights==0.1.0
azure-mgmt-powerbiembedded==2.0.0
azure-mgmt-rdbms==1.9.0
azure-mgmt-recoveryservices==0.3.0
azure-mgmt-recoveryservicesbackup==0.3.0
azure-mgmt-redis==5.0.0
azure-mgmt-relay==0.1.0
azure-mgmt-reservations==0.2.1
azure-mgmt-resource==2.0.0
azure-mgmt-scheduler==2.0.0
azure-mgmt-search==2.1.0
azure-mgmt-servicebus==0.5.3
azure-mgmt-servicefabric==0.2.0
azure-mgmt-signalr==0.1.1
azure-mgmt-sql==0.9.1
azure-mgmt-storage==2.0.0
azure-mgmt-subscription==0.2.0
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.35.0
azure-nspkg==3.0.2
azure-search-documents==1.0.0b2
azure-servicebus==0.21.1
azure-servicefabric==6.3.0.0
azure-servicemanagement-legacy==0.20.6
azure-storage-blob==12.3.0
azure-storage-common==2.1.0
azure-storage-file==1.4.0
azure-storage-file-datalake==12.0.0
azure-storage-file-share==12.1.1
azure-storage-queue==2.1.0
azureml-automl-core==1.0.72.1
azureml-contrib-notebook==1.0.72
azureml-core==1.0.72
azureml-dataprep==1.1.30
azureml-dataprep-native==13.1.0
azureml-defaults==1.0.72
azureml-explain-model==1.0.72
azureml-interpret==1.0.72.1
azureml-model-management-sdk==1.0.1b6.post1
azureml-opendatasets==1.0.72.1
azureml-pipeline==1.0.72
azureml-pipeline-core==1.0.72
azureml-pipeline-steps==1.0.72
azureml-sdk==1.0.72
azureml-telemetry==1.0.72
azureml-train==1.0.72
azureml-train-automl==1.0.72
azureml-train-core==1.0.72
azureml-train-restclients-hyperdrive==1.0.72
azureml-widgets==1.0.72
Babel==2.6.0
backcall==0.1.0
backports.shutil-get-terminal-size==1.0.0
backports.tempfile==1.0
backports.weakref==1.0rc1
bcrypt==3.1.7
beautifier==0.5.5
beautifulsoup4==4.6.3
bitarray==0.8.3
bkcharts==0.2
blaze==0.11.3
bleach==1.5.0
bokeh==0.13.0
boto==2.49.0
boto3==1.4.8
botocore==1.8.50
Bottleneck==1.2.1
bqplot==0.12.0
brewer2mpl==1.4.1
bz2file==0.98
CacheControl==0.12.5
cachetools==3.1.1
certifi==2018.10.15
cffi==1.11.5
characteristic==14.3.0
chardet==3.0.4
Click==7.0
cloudpickle==1.2.2
clyent==1.2.2
cntk==2.5.1
colorama==0.3.9
conda==4.5.11
conda-build==3.16.0
configparser==3.7.4
constantly==15.1.0
contextlib2==0.5.5
coverage==3.7.1
coveralls==0.5
cryptography==2.3.1
cycler==0.10.0
Cython==0.29.14
cytoolz==0.9.0.1
dask==0.19.3
datacleaner==0.1.5
datascience==0.10.6
datashape==0.5.4
decorator==4.3.0
defusedxml==0.5.0
Deprecated==1.2.6
dill==0.3.1.1
distributed==1.23.3
distro==1.4.0
docker==4.1.0
docker-py==1.10.6
docker-pycreds==0.4.0
docopt==0.6.2
docutils==0.14
Dora==0.0.2
dotnetcore2==2.1.10
edward==1.3.5
elasticsearch==7.0.5
entrypoints==0.2.3
et-xmlfile==1.0.1
fastcache==1.0.2
feedparser==5.2.1
filelock==3.0.8
fire==0.2.1
Flask==1.0.3
Flask-Cors==3.0.6
folium==0.2.1
ftfy==5.3.0
fusepy==3.0.1
future==0.16.0
futures==3.1.1
gast==0.3.2
GDAL==2.3.0
gensim==3.8.1
gevent==1.3.6
ggplot==0.11.5
glob2==0.6
gmpy2==2.0.8
google-auth==1.7.0
google-auth-oauthlib==0.4.1
google-pasta==0.1.8
graphviz==0.13.2
greenlet==0.4.15
grpcio==1.25.0
gunicorn==19.9.0
gym==0.15.3
h5py==2.8.0
hdmedians==0.13
heapdict==1.0.0
holoviews==1.10.7
html5lib==0.9999999
humanfriendly==4.18
hyperlink==18.0.0
idna==2.7
idna-ssl==1.1.0
imageio==2.4.1
imagesize==1.1.0
incremental==17.5.0
interpret-community==0.1.0.3.2
interpret-core==0.1.18
ipykernel==5.1.3
ipython==7.1.1
ipython-genutils==0.2.0
ipywidgets==7.5.1
isodate==0.6.0
isort==4.3.4
itsdangerous==0.24
jdcal==1.4
jedi==0.13.1
jeepney==0.4
Jinja2==2.10
jmespath==0.9.4
joblib==0.14.0
json-logging-py==0.2
JsonForm==0.0.2
jsonpickle==1.2
jsonschema==2.6.0
JsonSir==0.0.2
jupyter==1.0.0
jupyter-client==5.2.3
jupyter-console==6.0.0
jupyter-core==4.4.0
jupyterlab==0.34.12
jupyterlab-launcher==0.13.1
kafka-python==1.4.7
kazoo==2.5.0
Keras==2.3.1
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
keras2onnx==1.6.0
keyring==13.2.1
kiwisolver==1.0.1
klein==19.6.0
knack==0.5.1
Kqlmagic==0.1.107.post1
lancet-ioam==0.9.0
lazy-object-proxy==1.3.1
liac-arff==2.4.0
libarchive-c==2.8
lightgbm==2.3.0
line-profiler==2.1.2
llvmlite==0.25.0
locket==0.2.0
lockfile==0.12.2
luigi==2.8.2
lxml==4.2.5
Markdown==3.0.1
MarkupSafe==1.1.0
matplotlib==3.0.0
mccabe==0.6.1
memory-profiler==0.56.0
mistune==0.8.4
mkl-fft==1.0.6
mkl-random==1.0.1
mock==2.0.0
more-itertools==4.3.0
mpmath==1.0.0
msal==1.2.0
msal-extensions==0.1.3
msgpack==0.5.6
msrest==0.6.10
msrestazure==0.6.2
multidict==4.7.5
multimethods==1.0.0
multipledispatch==0.6.0
natsort==5.4.0
navigator-updater==0.2.1
nbconvert==5.6.1
nbformat==4.4.0
ndg-httpsclient==0.5.1
networkx==2.2
nimbusml==1.5.0
nltk==3.3
nose==1.3.7
notebook==5.7.2
numba==0.40.0
numexpr==2.6.8
numpy==1.16.2
numpydoc==0.8.0
oauthlib==3.1.0
odo==0.5.1
okpy==1.13.11
olefile==0.46
onnx==1.6.0
onnxconverter-common==1.6.0
onnxmltools==1.6.0
onnxruntime==1.0.0
openfst==1.6.1
openpyxl==2.5.8
packaging==18.0
pandas==0.23.4
pandasql==0.7.3
pandocfilters==1.4.2
papermill==1.2.1
param==1.7.0
paramiko==2.6.0
parso==0.3.1
partd==0.3.8
path.py==11.1.0
pathlib2==2.3.2
pathspec==0.6.0
patsy==0.5.1
pbr==4.2.0
pep8==1.7.1
pexpect==4.6.0
phonenumbers==8.10.22
pickleshare==0.7.5
Pillow==5.3.0
pkginfo==1.4.2
plotly==4.2.1
pluggy==0.7.1
ply==3.11
pmdarima==1.1.1
portalocker==1.5.1
prettypandas==0.0.4
prettytable==0.7.2
prometheus-client==0.4.2
prompt-toolkit==2.0.7
protobuf==3.10.0
psutil==5.4.7
psycopg2==2.7.5
ptyprocess==0.6.0
py==1.6.0
py4j==0.10.7
pyang==2.1
pyarrow==0.13.0
pyasn1==0.4.4
pyasn1-modules==0.2.2
pycodestyle==2.4.0
pycosat==0.6.3
pycparser==2.19
pycrypto==2.6.1
pycurl==7.43.0.2
pydot==1.4.1
pyflakes==2.0.0
PyGithub==1.44.1
pyglet==1.3.2
Pygments==2.2.0
PyHamcrest==1.9.0
PyJWT==1.7.1
pykafka==2.8.0
pylint==2.1.1
pymc==2.3.6
pymc3==3.7
pymongo==3.7.1
Pympler==0.7
pymssql==2.1.1
PyMySQL==0.9.2
PyNaCl==1.3.0
pyodbc==3.1.1
pyOpenSSL==18.0.0
pypachy==0.1.5
pyparsing==2.3.0
pyprof2calltree==1.4.4
PySocks==1.6.8
pyspark==2.4.4
pytest==3.8.2
pytest-arraydiff==0.2
pytest-astropy==0.4.0
pytest-doctestplus==0.1.3
pytest-openfiles==0.3.0
pytest-remotedata==0.3.0
python-daemon==2.1.2
python-dateutil==2.8.1
Python-EasyConfig==0.1.7
pytz==2019.3
pyviz-comms==0.6.0
PyWavelets==1.0.1
PyYAML==3.13
pyzmq==17.1.2
QtAwesome==0.5.0
qtconsole==4.4.2
QtPy==1.5.1
requests==2.22.0
requests-oauthlib==1.3.0
Resource==0.2.1
retrying==1.3.3
rope==0.11.0
rpy2==3.0.5
rsa==4.0
ruamel-yaml==0.15.46
ruamel.yaml==0.15.89
s3transfer==0.1.13
scikit-bio==0.5.5
scikit-image==0.16.2
scikit-learn==0.20.3
scipy==1.1.0
scrubadub==1.2.1
seaborn==0.9.0
SecretStorage==3.1.0
Send2Trash==1.5.0
service-identity==17.0.0
shap==0.29.3
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.11.0
skl2onnx==1.4.9
sklearn==0.0
sklearn-pandas==1.7.0
smart-open==1.9.0
snakeviz==2.0.1
snowballstemmer==1.2.1
sortedcollections==1.0.1
sortedcontainers==2.0.5
Sphinx==1.8.1
sphinxcontrib-websupport==1.1.0
spyder==3.3.1
spyder-kernels==0.2.6
SQLAlchemy==1.2.14
statsmodels==0.9.0
sympy==1.3
tables==3.4.4
tabulate==0.8.2
tb-nightly==1.14.0a20190603
tblib==1.3.2
tenacity==6.0.0
tensorboard==2.0.1
tensorflow==2.0.0b1
termcolor==1.1.0
terminado==0.8.1
testpath==0.4.2
textblob==0.15.3
textwrap3==0.9.2
tf-estimator-nightly==1.14.0.dev2019060501
tf2onnx==1.5.3
Theano==1.0.4
toolz==0.9.0
torch==1.3.1
torchvision==0.4.2
tornado==4.5.3
tqdm==4.26.0
traitlets==4.3.2
traittypes==0.2.1
treq==18.6.0
Tubes==0.2.0
Twisted==18.7.0
typed-ast==1.1.0
typing==3.7.4.1
typing-extensions==3.7.4.1
uamqp==1.2.6
unicodecsv==0.14.1
update-checker==0.16
urllib3==1.23
wcwidth==0.1.7
webencodings==0.5.1
websocket-client==0.56.0
Werkzeug==0.14.1
wget==3.2
widgetsnbextension==3.5.1
word2vec==0.10.2
wrapt==1.11.2
xlrd==1.1.0
XlsxWriter==1.1.1
xlwt==1.3.0
yarl==1.4.2
zict==0.1.3
zope.interface==4.5.0

To test:

  • I just spun up a fresh Azure Notebook with a different email address. After running your recommendations, I'm able to import the BlobServiceClient module without issue.
  • Selected python 3.6
    image
  • Initial !pip freeze azure modules:
azure==4.0.0
azure-applicationinsights==0.1.0
azure-batch==4.1.3
azure-cli-core==2.0.54
azure-cli-nspkg==3.0.4
azure-cli-telemetry==1.0.4
azure-common==1.1.23
azure-cosmosdb-nspkg==2.0.2
azure-cosmosdb-table==1.0.6
azure-datalake-store==0.0.48
azure-eventgrid==1.3.0
azure-graphrbac==0.40.0
azure-keyvault==1.1.0
azure-kusto-data==0.0.38
azure-kusto-ingest==0.0.38
azure-loganalytics==0.1.0
azure-mgmt==4.0.0
azure-mgmt-advisor==1.0.1
azure-mgmt-applicationinsights==0.1.1
azure-mgmt-authorization==0.50.0
azure-mgmt-batch==5.0.1
azure-mgmt-batchai==2.0.0
azure-mgmt-billing==0.2.0
azure-mgmt-cdn==3.1.0
azure-mgmt-cognitiveservices==3.0.0
azure-mgmt-commerce==1.0.1
azure-mgmt-compute==4.6.2
azure-mgmt-consumption==2.0.0
azure-mgmt-containerinstance==1.5.0
azure-mgmt-containerregistry==2.8.0
azure-mgmt-containerservice==4.4.0
azure-mgmt-cosmosdb==0.4.1
azure-mgmt-datafactory==0.6.0
azure-mgmt-datalake-analytics==0.6.0
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.5.0
azure-mgmt-datamigration==1.0.0
azure-mgmt-devspaces==0.1.0
azure-mgmt-devtestlabs==2.2.0
azure-mgmt-dns==2.1.0
azure-mgmt-eventgrid==1.0.0
azure-mgmt-eventhub==2.6.0
azure-mgmt-hanaonazure==0.1.1
azure-mgmt-iotcentral==0.1.0
azure-mgmt-iothub==0.5.0
azure-mgmt-iothubprovisioningservices==0.2.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-loganalytics==0.2.0
azure-mgmt-logic==3.0.0
azure-mgmt-machinelearningcompute==0.4.1
azure-mgmt-managementgroups==0.1.0
azure-mgmt-managementpartner==0.1.1
azure-mgmt-maps==0.1.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-media==1.0.0
azure-mgmt-monitor==0.5.2
azure-mgmt-msi==0.2.0
azure-mgmt-network==2.7.0
azure-mgmt-notificationhubs==2.1.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-policyinsights==0.1.0
azure-mgmt-powerbiembedded==2.0.0
azure-mgmt-rdbms==1.9.0
azure-mgmt-recoveryservices==0.3.0
azure-mgmt-recoveryservicesbackup==0.3.0
azure-mgmt-redis==5.0.0
azure-mgmt-relay==0.1.0
azure-mgmt-reservations==0.2.1
azure-mgmt-resource==2.0.0
azure-mgmt-scheduler==2.0.0
azure-mgmt-search==2.1.0
azure-mgmt-servicebus==0.5.3
azure-mgmt-servicefabric==0.2.0
azure-mgmt-signalr==0.1.1
azure-mgmt-sql==0.9.1
azure-mgmt-storage==2.0.0
azure-mgmt-subscription==0.2.0
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.35.0
azure-nspkg==3.0.2
azure-servicebus==0.21.1
azure-servicefabric==6.3.0.0
azure-servicemanagement-legacy==0.20.6
azure-storage-blob==2.1.0
azure-storage-common==2.1.0
azure-storage-file==1.4.0
azure-storage-queue==2.1.0
azureml-automl-core==1.0.72.1
azureml-contrib-notebook==1.0.72
azureml-core==1.0.72
azureml-dataprep==1.1.30
azureml-dataprep-native==13.1.0
azureml-defaults==1.0.72
azureml-explain-model==1.0.72
azureml-interpret==1.0.72.1
azureml-model-management-sdk==1.0.1b6.post1
azureml-opendatasets==1.0.72.1
azureml-pipeline==1.0.72
azureml-pipeline-core==1.0.72
azureml-pipeline-steps==1.0.72
azureml-sdk==1.0.72
azureml-telemetry==1.0.72
azureml-train==1.0.72
azureml-train-automl==1.0.72
azureml-train-core==1.0.72
azureml-train-restclients-hyperdrive==1.0.72
azureml-widgets==1.0.72
  • !pip install -U azure-storage-blob
  • from azure.storage.blob import BlobServiceClient
    - Ran without issue!
  • It appears my initial Azure Notebook instance was "corrupted" or has conflicts. I'll diff the !pip freezes from each account and report what I find.
    Thank you

Sweeeeeeeet! After installing few missing modules (lining up my previous AN env with the clean one), I'm now able to import BlobServiceClient.
Thanks again.

Weird... back to same error cannot import name BlockBlobService in Azure Notebooks.. What the heck?

I think this ticket might need to be reopened?

Looked into the source code where BlockBlobService should exist ([__init__.py](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py) file from azure.storage.blob) but its no longer there.

I tried to get it from my local environment (after using pip to install, got version 12.3.1) but I also did not find it :(

  • Has the name of the class changed?
  • Is there a different ticket tracking this issue?

There is new documentation!
Also found this ticket

Was this page helpful?
0 / 5 - 0 ratings