# AttributeError with dvc.api.read to azure blob storage

**URL:** <https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688>\
**Category:** Questions\
**Created:** [February 25, 2021, 11:17am UTC](https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688 "2021-02-25T11:17:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![svenw3](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@svenw3](https://discuss.dvc.org/u/svenw3)\
**Post date:** [February 25, 2021, 11:17am UTC](https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688/1 "2021-02-25T11:17:10Z")

</div>

Hello,

I am new to DVC and evaluate it in a proof of concept implementation for our ML projects, which seems to fit perfectly! But I encounter a problem with dvc.api.open while using an Azure Blob Storage.

What I have done:

- cloned [GitHub - iterative/dataset-registry: Dataset registry DVC project](https://github.com/iterative/dataset-registry)
- dvc remote add -d myremote azure://BLOB/PATH
- dvc remote modify --local myremote connection\_string ‘CONNECTION\_STRING’
- created test file
- dvc add & push
- removed the test file incl. cache from local repo
- dvc.api.read ==\> AttributeError
- dvc pull
- dvc.api.read ==\> works

I am able to use dvc push and dvc pull, but by using dvc.api.read I get “AttributeError: ‘NoneType’ object has no attribute ‘account\_key’” (see attached screenshots). If the file is downloaded with dvc pull and it is available in the cache folder everything works.

Can anyone point me to the problem or my misunderstanding? I want to use the streaming functionality, as we have very large files and do not want to store them on the storage of a virtual machine.

Thanks!

 ![Unbenannt](https://canada1.discourse-cdn.com/flex035/uploads/dataversioncontrol/original/1X/3a37b2884021232141bb6f25c162527b698ad682.jpeg)

---

<div class="post-metadata">

**Author:** ![pmrowla](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pmrowla](https://discuss.dvc.org/u/pmrowla)\
**Post date:** [February 25, 2021, 11:53am UTC](https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688/2 "2021-02-25T11:53:13Z")

</div>

Hi @svenw3, could you please run `dvc doctor` from the command line and then post the output here?

---

<div class="post-metadata">

**Author:** ![svenw3](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@svenw3](https://discuss.dvc.org/u/svenw3)\
**Post date:** [February 25, 2021, 1:11pm UTC](https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688/3 "2021-02-25T13:11:44Z")

</div>

## DVC version: 1.11.16 (pip)

Platform: Python 3.9.1 on Windows-10-10.0.18362-SP0  
Supports: azure, http, https  
Cache types: hardlink  
Caches: local  
Remotes: https, azure  
Repo: dvc, git

---

<div class="post-metadata">

**Author:** ![pmrowla](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pmrowla](https://discuss.dvc.org/u/pmrowla)\
**Post date:** [February 25, 2021, 1:40pm UTC](https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688/4 "2021-02-25T13:40:04Z")

</div>

It looks like the problem here is related to a known limitation in DVC, where local config settings (such as those set via `dvc remote modify --local ...`) are not used by certain DVC commands, including `api.open()` and `api.read()`.

The good news is that this limitation has been addressed in an upcoming release, however we are not currently planning to backport these changes into DVC 1.11.x.

Would you mind trying the pre-release version (see: [https://dvc.org/blog/dvc-2-0-pre-release#install](https://dvc.org/blog/dvc-2-0-pre-release#install)) from pip, and checking if that resolves your issue? When you install the prerelease version, don’t forget to also install the `azure` dependency

```auto
pip install --upgrade --pre dvc[azure]

```

---

<div class="post-metadata">

**Author:** ![svenw3](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@svenw3](https://discuss.dvc.org/u/svenw3)\
**Post date:** [February 25, 2021, 2:48pm UTC](https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688/5 "2021-02-25T14:48:18Z")

</div>

Thanks for your fast reply! The problem still exists with version 2.0, see the attached screenshot.

 ![Unbenannt1](https://canada1.discourse-cdn.com/flex035/uploads/dataversioncontrol/original/1X/20118ca8cd5dfa0f128b7b27325cd3b96430cbd9.jpeg)

---

<div class="post-metadata">

**Author:** ![pmrowla](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pmrowla](https://discuss.dvc.org/u/pmrowla)\
**Post date:** [February 26, 2021, 12:23am UTC](https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688/6 "2021-02-26T00:23:42Z")

</div>

Looks like this is an azure specific bug then, would you mind filing a bug report on our github?

---

<div class="post-metadata">

**Author:** ![svenw3](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@svenw3](https://discuss.dvc.org/u/svenw3)\
**Post date:** [February 26, 2021, 5:44am UTC](https://discuss.dvc.org/t/attributeerror-with-dvc-api-read-to-azure-blob-storage/688/7 "2021-02-26T05:44:45Z")

</div>

thanks, I will fill in a bug report later today.

EDIT:  
See: [dvc.api.read: AttributeError while using azure blob storage for streaming data · Issue #5524 · iterative/dvc · GitHub](https://github.com/iterative/dvc/issues/5524)
