-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot import name 'BlockBlobService' #389
Comments
Hi @melzoghbi, that seems very odd, could you please do a Normally you should see the following azure packages:
Which version of python are you using? |
This is what i got when i executed pip freeze: azure-common==1.1.8 But i still get the same error. |
@melzoghbi which version of Python are you using? |
3.6.3 This is the Python version i am running on my notebook. |
Hi @melzoghbi, I'm unable to reproduce this problem. It does not seem to be a problem with the storage package. Could you please try again with a different virtual environment? Thanks! |
I get the same error with Python 2.7.12 |
Got the same on 3.6.4 |
got the same error on Python 3.6.5 |
Works perfectly fine for me: virtualenv venv
source venv/bin/activate
pip install azure-storage-blob==0.37.1
python from azure.storage.blob import BlockBlobService
I'd suggest updating to a newer version and increasing the logging verbosity for diagnosis. As @zezha-msft said, it sounds like something with your overall system setup isn't correct... |
@zezha-msft can you please reopen this issue? It seems that Steps to reproduce: Environment and Python version:
Output of pip freeze:
Error (note that only the second import statement throws an error):
|
Still getting this error. |
Your code might still be using the legacy Python BlobSDK (https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python-legacy) |
Hi @courtenayparserr |
Hi @xiafu-msft . Thanks for the speedy reply. Unfortunately its still a problem. I created a virtual environment, and activated it: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/ Did the pip install azure-storage-blob==2.1.0. That installed fine. But same error. |
Hi @courtenayparserr |
Hi @xiafu-msft Thanks for your help. Its: azure-common==1.1.23 |
Hi @xiafu-msft Any progress here? |
Hi @courtenayparserr |
For me it worked after I installed azure package: I noticed that it uninstalls latest version (12.0) of azure-storage-blob Now I have these: |
Hi I am having problem importing BlockBlobService using both azure-storage-blob==2.1.0 and azure-storage-blob==12.0.0 under Python 3.7.6. |
I think there is some dependency bug in the source code (version azure-storage-blob==2.1.0 ) of blockblobservice.py and init.py under site-packages/azure/storage/blob/ directory. Because when I type in |
Hi @harmonyliu Let me know if it's still not working |
This works for me pip install azure-storage --upgrade after this pip freeze gives azure==4.0.0 now I am able to run following |
This worked for me azure-batch==6.0.0 |
Wah, I'm a ranting baby here. My apologies!This is very confusing...
|
Ok. I've been able to figure out how to get
|
@SeaDude I think that solution doesn't work anymore, I've tried quite a few times with every possible solution. I need to know if anyone is able to run |
Hi @prakharcode While it seems azure CLI has a multi version api package, and if you really want to use v12 and v2.1.0 together, let's see if they can help |
@xiafu-msft In the same situation as @prakharcode, not sure what your solution entails we do. Should we test it out with multiple version of the Azure CLI? |
@vipulgupta2048 I just left the old version (v2.1) altogether and implemented everything on (v12.0) :) |
I am trying to move from azure-storage-blob==1.5.0 to 12.3.2, but I can't figure out for the life of me how to import BlockBlobService in the new version! With 1.5.0, I import and use as follows:
When I do that, though, I get the << Module 'azure.storage.blob' has no 'BlockBlobService' member >> error on the attempt to connect to the blob. I've tried a bunch of different ways to import the blockblobservice object, but just can't seem to come up with anything that works. |
Hi @dxkaufman To get text content of blob in v12.3.2, you should do the following thing
|
Hi @xiafu-msft I appreciate the sample. All the samples I was looking at last night seem to create a container before accessing it, even when the description is just for reading a blob. I found that a little confusing, though I surmised that the assumption was that the container didn't exist yet, and your example seems to make that clearer. Dylan |
Thank you for the example of how to use An alternative is to instantiate a separate
|
For me it was just pip install azure-storage-blob==2.1.0 |
I'm seeing this error and have yet to find a solution that works is 2021.
pip freeze
How can I get this code to run? |
You seem to have far too much (& incompatible) stuff installed. Do not mix this repo and similar storage libraries with azure-sdk-for-python libraries. $ python --version
> Python 3.8.10
$ pip install azure-storage-blob
> ...
$ pip freeze
> azure-core==1.15.0
> azure-storage-blob==12.8.1
> certifi==2021.5.30
> cffi==1.14.5
> chardet==4.0.0
> cryptography==3.4.7
> idna==2.10
> isodate==0.6.0
> msrest==0.6.21
> oauthlib==3.1.1
> pycparser==2.20
> requests==2.25.1
> requests-oauthlib==1.3.0
> six==1.16.0
> urllib3==1.26.5
$ python -c "from azure.storage.blob import BlobClient" && echo $?
> 0 I suggest to use |
this worked for me when I was dealing with BlockBlobService import issues |
Hi @xiafu-msft Any suggestions on the above please :) |
you are a legend, worked for me. thanks! |
Hi,
I have azure-storage-blob version 0.37.1 and still i get an error when i import BlockBlobService.
from azure.storage.blob import BlockBlobService # import azure sdk packages
Error message:
ImportError: cannot import name 'BlockBlobService'
Here is a list of existing azure storage packages in my current virtual environment:
azure-storage-blob==0.37.1
azure-storage-common==0.37.1
azure-storage-nspkg==2.0.0
How can i fix this?
Thanks.
The text was updated successfully, but these errors were encountered: