Cannot import name BlockBlobService

2024/11/15 6:35:26

I got the following error:

from azure.storage.blob import BlockBlobService 
ImportError: cannot import name 'BlockBlobService'

when trying to run my python project using command prompt. (The code seems to work when i execute it directly from anaconda navigator.)

I am using Python 3.6.4 for Anaconda. Running pip freeze gives me the following:

azure-nspkg==2.0.0   
azure-storage-blob==1.1.0
azure-storage-common==1.1.0 
azure-storage-nspkg==3.0.0
azurepython3==1.7.7
Answer

There is no need to install the entire azure package.

I believe you are using the new azure-storage-blob library, but since BlockBlobService is from the old azure-storage library, to continue using it, you need to pip uninstall azure-storage-blob if you have installed the new library by accident, and then pip install azure-storage to install the old library.

If you would like to use the new library or cannot do the above, feel free to refer to my answer here which details the context and full instructions of using either the new azure-storage-blob library or the old azure-storage library.

https://en.xdnf.cn/q/72139.html

Related Q&A

Legend outside the plot in Python - matplotlib

Im trying to place a rather extensive legend outside my plot in matplotlib. The legend has quite a few entries, and each entry can be quite long (but I dont know exactly how long).Obviously, thats quit…

Filter items that only occurs once in a very large list

I have a large list(over 1,000,000 items), which contains english words:tokens = ["today", "good", "computer", "people", "good", ... ]Id like to get al…

Get Data JSON in Flask

Even following many example here & there, i cant get my API work in POST Method. Here the code about it :from flask import Flask, jsonify, request@app.route(/api/v1/lists, methods=[POST]) def add_e…

Commands working on windows command line but not in Git Bash terminal

I am trying to run certain commands in Git Bash but they continue to hang and not display anything. When I run them in the Windows command prompt they work.For example, in my windows command prompt the…

RBF interpolation: LinAlgError: singular matrix

The following call:rbf = Rbf(points[0], points[1], values,epsilon=2)results in an error:LinAlgError: singular matrixwith the following values:In [3]: points Out[3]: (array([71, 50, 48, 84, 71, 74, 89,…

What does `\x1b(B` do?

Im a Blessed user, and recently, when I tried to find out the contents of the term.bold() function, I got this output: \x1b[1m\x1b(B\x1b[mI understand what \x1b[1m and \x1b[m do, but what does \x1b(B d…

Not clicking all tabs and not looping once issues

I am trying to click the tabs on the webpage as seen below. Unfortunately, it only seems to click some of the tabs despite correct correct xpath in inspect Chrome. I can only assume it’s not clickin…

Opencv stream from a camera connected to a remote machine

I am developing a wx application in python for streaming and displaying video from two different webcams. This works fine, but now I need to do this in a different scenario in which the two cameras are…

Is there a callable equivalent to f-string syntax?

Everybody loves Python 3.6s new f-strings:In [33]: foo = {blah: bang}In [34]: bar = blahIn [35]: f{foo[bar]} Out[35]: bangHowever, while functionally very similar, they dont have the exact same semanti…

Python: list comprehension based on previous value? [duplicate]

This question already has answers here:Python list comprehension - access last created element(9 answers)Closed 10 months ago.Say I want to create a list using list comprehension like:l = [100., 50., 2…