0

I'm trying to use Azure-storage-blob with Python importing with

from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient

and installed in my .venv with pip install azure-storage-blob and required in requirements.txt with azure-storage-blob This is my pip list of the environment

Package                   Version
------------------------- ---------
adal                      1.2.7
azure-common              1.1.28
azure-core                1.21.1
azure-cosmos              4.2.0
azure-functions           1.8.0
azure-mgmt-datalake-nspkg 3.0.1
azure-mgmt-nspkg          3.0.2
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-subscription   0.2.0
azure-mgmt-trafficmanager 0.50.0
azure-mgmt-web            0.35.0
azure-nspkg               3.0.2
azure-storage-blob        12.9.0
azure-storage-common      2.1.0
backcall                  0.2.0
certifi                   2021.10.8
cffi                      1.15.0
charset-normalizer        2.0.9
click                     8.0.4
colorama                  0.4.4
cryptography              36.0.1
cycler                    0.11.0
debugpy                   1.5.1
decorator                 5.1.0
entrypoints               0.3
fonttools                 4.28.5
idna                      3.3
ipykernel                 6.6.0
ipython                   7.30.1
isodate                   0.6.1
itsdangerous              2.1.0
jedi                      0.18.1
Jinja2                    3.0.3
jupyter-client            7.1.0
jupyter-core              4.9.1
msrest                    0.6.21
msrestazure               0.6.4
nest-asyncio              1.5.4
numpy                     1.21.5
oauthlib                  3.2.0
packaging                 21.3
pandas                    1.3.5
parso                     0.8.3
pickleshare               0.7.5
Pillow                    8.4.0
pip                       22.0.3
prompt-toolkit            3.0.24
pycparser                 2.21
pydocumentdb              2.3.5
Pygments                  2.11.0
PyJWT                     2.3.0
pymongo                   4.0.1
pyparsing                 3.0.6
python-dateutil           2.8.2
python-dotenv             0.19.2
pytz                      2021.3
pywin32                   303
pyzmq                     22.3.0
requests                  2.26.0
requests-oauthlib         1.3.1

But im getting Import "azure.storage.blob" could not be resolved How can I solve this problem??

UPDATE: It just don't work in my .venv and under lib/site-package/azure there is not "storage" folder

Alessio
  • 57
  • 8
  • Are you sure that your environment is activated when you are running your code? – Steven Robyns Feb 27 '22 at 14:16
  • Yes, in the terminal I see (.venv), it is active. – Alessio Feb 27 '22 at 14:20
  • And are you getting "Import "azure.storage.blob" could not be resolved" when you are actually running your code, or is it only a hint given by your IDE and does your code execute correctly? Reason I'm asking: https://stackoverflow.com/questions/64141052/unresolved-import-azure-storage-blob-when-trying-to-use-python-library-azure-s – Steven Robyns Feb 27 '22 at 14:24
  • When I run my code it say ModuleNotFoundError: No module named 'azure.storage'. In fact in my .venv under Lib/site-package/azure I don't see "storage" folder, but when try to install azure-storage-blob it say that the it is installed – Alessio Feb 27 '22 at 14:39

2 Answers2

0

Try either of the following ways to resolve Import "azure.storage.blob" could not be resolved error:

1. If you are using visual studio code, try following command to install azure-storage-blob:

conda install -c anaconda azure conda install -c conda-forge azure-storage-blob  

2. Uninstall older version of azure-storage-blob’ and reinstall: pip uninstall azureandpip uninstall azure-storage`

Reinstall at the specific path:

cdd .venv

pip install azure-storage –upgrade

References: Unresolved import 'azure.storage.blob' when trying to use Python library azure-storage-blob , How to import Azure BlobService in python? and Install Azure Python api on linux: importError: No module named storage.blob

Madhuraj Vadde
  • 1,099
  • 1
  • 5
  • 13
0

Thanks to everyone I solved recreating .venv

Alessio
  • 57
  • 8