question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed uploading: cannot import name 'BlockType' from 'azure.storage.blob'

See original GitHub issue

Greetings ClearML team!

We have an issue with the latest ClearML version including PR https://github.com/allegroai/clearml/pull/548 (support newer azure storage python version).

Affected versions: 1.2.0, 1.3.0

Some uploads are failing like this:

2022-03-05 17:32:38,194 - clearml.storage - ERROR - Failed uploading: cannot import name 'BlockType' from 'azure.storage.blob' (/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/azure/storage/blob/__init__.py)
2022-03-05 17:32:38,194 - clearml.storage - ERROR - Exception encountered while uploading Upload failed
Traceback (most recent call last):
  File "/root/.clearml/venvs-builds/3.8/task_repository/repo.git/export/model_export.py", line 42, in default_clearml_export
    task.upload_artifact(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/task.py", line 1699, in upload_artifact
    return self._artifacts_manager.upload_artifact(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/artifacts.py", line 617, in upload_artifact
    uri = self._upload_local_file(local_filename, name,
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/artifacts.py", line 799, in _upload_local_file
    StorageManager.upload_file(local_file.as_posix(), uri, wait_for_upload=True, retries=ev.retries)
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/storage/manager.py", line 76, in upload_file
    return CacheManager.get_cache_manager().upload_file(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/storage/cache.py", line 91, in upload_file
    result = helper.upload(
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/storage/helper.py", line 579, in upload
    res = self._do_upload(src_path, dest_path, extra, cb, verbose=False, retries=retries)
  File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/storage/helper.py", line 993, in _do_upload
    raise last_ex
ValueError: Upload failed

The problematic line is in helper.py:

from azure.storage.blob import BlockType  # noqa
client.append_block(chunk, BlockType.AppendBlob)

I have tested several versions of azure-blob-service (12.0.0, 12.1.0, 12.2.0, 12.3.0, 12.4.0, 12.5.0, 12.6.0, 12.7.0, 12.8.0, 12.9.0) and with none of them, the import works.

Which azure-storage version this is supposed to run with?

In the example code from Azure I found that appending to blob works differently: https://github.com/Azure/azure-storage-python/blob/4306898850dd21617644fc537a57d025e833db74/samples/blob/append_blob_usage.py#L248

Thanks for you help!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jkhenningcommented, Mar 8, 2022

Hi @tkupek,

Thanks for this detailed description! We’ll update soon 🙂

0reactions
tkupekcommented, Mar 28, 2022

Thank you for your patience. We upgraded to 1.3.1 and the issue is fully resolved. Great work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot import name 'BlockBlobService' · Issue #389 - GitHub
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 ...
Read more >
cannot import name 'BlockBlobService' from 'azure.storage ...
I am getting the following error when I try to import BlockBlobService in my Python code to deal with Azure Blob Storage. I...
Read more >
azure-storage-blob - PyPI
Create a container from where you can upload or download blobs. from azure.storage.blob import ContainerClient container_client = ContainerClient.
Read more >
Cannot import AppendBlob from Azure Storage blob
However when I import AppendBlob, I am always getting an error "cannot import name 'AppendBlobService' from 'azure.storage.blob' ".
Read more >
Cannot import name 'BlobServiceClient' from 'azure.storage ...
To solve the error, upgrade the module by running the pip install azure-storage-blob --upgrade command. importerror cannot import name ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found