简体   繁体   中英

Docker: cannot import name 'BlobServiceClient' from 'azure.storage.blob

I have this code running fine on my personal computer

from azure.storage.blob import BlobServiceClient
blob_client = BlobClient.from_blob_url(file_sas)

This is my local envir:

python --version
Python 3.10.4

$ pip show azure.storage.blob
Name: azure-storage-blob
Version: 12.14.1

I have a docker image where I force the same version of azure.storage.blob: Version: 12.14.1 . However, my python version is different.

# python3 --version
Python 3.8.10

And in docker I have the following error:

>>> from azure.storage.blob import BlobServiceClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob' (/usr/lib/python3/dist-packages/azure/storage/blob/__init__.py)

Any help welcome

The problem was that my docker image contained a previous older version of the package.

RUN sudo pip uninstall azure-storage-blob -y
RUN python3 -m pip install azure-storage-blob

Fixed it for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM