# Can't go to former version of dataset with \`dvc checkout\`

**URL:** <https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615>\
**Category:** Questions\
**Created:** [January 12, 2021, 11:29am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615 "2021-01-12T11:29:14Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 12, 2021, 11:29am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/1 "2021-01-12T11:29:14Z")

</div>

Hi,

I am trying out DVC for the first time for my deep learning development pipeline. As mentioned in the [Version Data with DVC](https://youtu.be/kLKBcPonMYw) tutorial, I created a folder named “dataset” in the main directory and then I added some data into it. And then I used `dvc add dataset` to track the dataset. After that, I included “dataset” folder in the .gitignore to untrack the dataset with git.

Then I setup Azure storage blob for my remote data repo. After adding some more data, I wanted to go back to the original version of the data so I checkout to that git commit and then used `dvc checkout` command. Then this error comes up.

```auto
+--------------------------------------------------+
| |
| Update available 1.10.2 -> 1.11.10 |
| Run `apt-get install --only-upgrade dvc` |
| |
+--------------------------------------------------+

WARNING: Cache 'HashInfo(name='md5', value='db4287e726604a63a231cf4462cb27df.dir', dir_info=None, size=497535926, nfiles=8818)' not found. File 'dataset' won't be created.
ERROR: Checkout failed for following targets:
dataset
Is your cache up to date?
<https://error.dvc.org/missing-files>

```

I tried searching for the solution in the given link but I could find it. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Paffciu](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@Paffciu](https://discuss.dvc.org/u/Paffciu)\
**Post date:** [January 12, 2021, 11:34am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/2 "2021-01-12T11:34:38Z")

</div>

@htutlynn  
Can you post result of `dvc doctor` command? Also, `dvc checkout -v` could be helpful.

I have a question: are you checking out your work on the same machine, or are you working on fresh clone of your repo?

---

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 12, 2021, 11:36am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/3 "2021-01-12T11:36:29Z")

</div>

Hi @Paffciu,

Here is the output of `dvc doctor` command.

```auto
Platform: Python 3.7.9 on Linux-5.4.0-58-generic-x86_64-with-debian-buster-sid
Supports: All remotes
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/sdb5
Caches: local
Remotes: azure
Workspace directory: ext4 on /dev/sdb5
Repo: dvc, git

```

Output of `dvc checkout -v` at initial dataset git commit.

```auto
2021-01-12 18:07:00,403 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/98/dfe29d5df6ee196c81f550443f8801' is unchanged since it is read-only
2021-01-12 18:07:00,403 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/22/dfe20acfd3c48dd0f4203d9f45bbba' is unchanged since it is read-only
2021-01-12 18:07:00,403 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/63/914ab4bdeef68cb5dcc2603e149792' is unchanged since it is read-only
2021-01-12 18:07:00,403 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/1b/45c831a48780b67dfe7d89a5b852d9' is unchanged since it is read-only
2021-01-12 18:07:00,403 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/02/2633c10858e12b1698397918bea4fb' is unchanged since it is read-only
2021-01-12 18:07:00,403 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/61/b573551adad906948553ea52acdeff' is unchanged since it is read-only
2021-01-12 18:07:00,403 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/20/24c6d77f07506dce96ab73fc20c3c4' is unchanged since it is read-only
2021-01-12 18:07:00,404 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/6d/3a6e50e8ea21a7535be7371ed5139a' is unchanged since it is read-only
2021-01-12 18:07:00,404 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/17/2cbcfbfa657c5d4ea41fe0f0b064b9' is unchanged since it is read-only
2021-01-12 18:07:00,404 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/4f/07c0739eafae00f1f34ea0a41b5851' is unchanged since it is read-only
2021-01-12 18:07:00,404 DEBUG: Assuming '/home/htut/Desktop/dvc_test/.dvc/cache/8f/1a65af83f9a8374bd27509a5f6f662' is unchanged since it is read-only
2021-01-12 18:07:00,404 DEBUG: Removing '/home/htut/Desktop/dvc_test/dataset'
2021-01-12 18:07:00,599 DEBUG: fetched: [(37086,)]
2021-01-12 18:07:00,698 ERROR: Checkout failed for following targets:
dataset
Is your cache up to date?
<https://error.dvc.org/missing-files>
------------------------------------------------------------
Traceback (most recent call last):
  File "dvc/main.py", line 90, in main
  File "dvc/command/checkout.py", line 65, in run
  File "dvc/command/checkout.py", line 49, in run
  File "dvc/repo/ __init__.py", line 60, in wrapper
  File "dvc/repo/checkout.py", line 108, in checkout
dvc.exceptions.CheckoutError: Checkout failed for following targets:
dataset
Is your cache up to date?
<https://error.dvc.org/missing-files>
------------------------------------------------------------
2021-01-12 18:07:00,699 DEBUG: Analytics is disabled.

```

---

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 12, 2021, 1:27pm UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/4 "2021-01-12T13:27:14Z")

</div>

@Paffciu , I am checking out my work on the same machine.

---

<div class="post-metadata">

**Author:** ![Paffciu](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@Paffciu](https://discuss.dvc.org/u/Paffciu)\
**Post date:** [January 12, 2021, 1:38pm UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/5 "2021-01-12T13:38:12Z")

</div>

@htutlynn  
And the project path is the same?  
If it is, can you verify that `{project_path}/.dvc/cache/db/4287e726604a63a231cf4462cb27df.dir` does not exist?

---

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 12, 2021, 1:45pm UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/6 "2021-01-12T13:45:45Z")

</div>

@Paffciu , I tried looking for `.dir` files but I could not find it.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/dataversioncontrol/original/1X/6a428a1b7847bb8bddb911ed1b291d6bbb1f58e9.png)

Btw, after adding `dataset` dir with `dvc add dataset`, I manually added `dataset` dir to the project’s main `.gitignore` file before git commit instead of the command that’s got prompted after `dvc add dataset` command. I am not sure but I kinda doubt that it might be the reason.

---

<div class="post-metadata">

**Author:** ![Paffciu](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@Paffciu](https://discuss.dvc.org/u/Paffciu)\
**Post date:** [January 12, 2021, 1:51pm UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/7 "2021-01-12T13:51:59Z")

</div>

@htutlyn it looks like the `dvc add` command has failed.  
Would it be possible for you to retry adding the dataset?  
Simplest verification that everything is allrigth would be:

1. `dvc add {data}`
2. `rm {data}`
3. `dvc checkout`

Adding `{data}` to .gitignore manually should no influence the cache.

---

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 12, 2021, 2:12pm UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/8 "2021-01-12T14:12:59Z")

</div>

@Paffciu , I just did the steps all over again. Re-added the dataset by using `dvc add dataset` and then delete the `dataset` folder with `rm -rf dataset`. When I tried to redo `dvc checkout` on latest commit, ti works as expected but when I go the `initial dataset` commit, and tries `dvc checkout`, it doesn’t work.

---

<div class="post-metadata">

**Author:** ![Paffciu](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@Paffciu](https://discuss.dvc.org/u/Paffciu)\
**Post date:** [January 12, 2021, 2:30pm UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/9 "2021-01-12T14:30:13Z")

</div>

@htutlynn  
I understand, was it done on your original repo - if so that does not change much because initial version of data had some problems adding.

Would it be possible to retake all the steps, like:

1. creating new repo
2. adding initial version of data
3. `rm -rf` data
4. `dvc checkout`  
?

---

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 13, 2021, 5:27am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/10 "2021-01-13T05:27:03Z")

</div>

HI @Paffciu, sorry for the late reply.  
Just like the steps that you described, I created everything from scratch and now it works as exactly as expected.  
As for the error, I think manually adding the `dataset` folder into the project’s main `.gitignore` caused the error. I didn’t include the step this time and now it works as expected without any errors.

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 13, 2021, 9:08am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/11 "2021-01-13T09:08:09Z")

</div>

@Paffciu , however when I try to do `dvc checkout` by going back to a former version of the dataset with git within a repo, cloned on a different machine, the error still persists.

---

<div class="post-metadata">

**Author:** ![Paffciu](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@Paffciu](https://discuss.dvc.org/u/Paffciu)\
**Post date:** [January 13, 2021, 9:13am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/12 "2021-01-13T09:13:26Z")

</div>

@htutlynn did you run `dvc fetch` on this particular revision? In case of working with fresh repo clone, you need to update local cache by running either `dvc pull` or `dvc fetch`.

`dvc pull` - you can simply think of it as `dvc fetch && dvc checkout`

---

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 13, 2021, 10:35am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/13 "2021-01-13T10:35:09Z")

</div>

@Paffciu , after pulling a fresh repo from github, I tried both approaches `dvc fetch` and `dvc pull`. After that, I go back to a former version of dataset and then used ‘dvc checkout’ but the error is still the same.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/dataversioncontrol/original/1X/d1febd7337f55f5242b792fa973e6087d22b8751.png)

However, if I go back to a former dataset commit after pulling fresh repo without immediately dvc pulling or dvc fetching, and then do `dvc checkout` on that commit it works without that cache not found error. I am not sure if it is supposed to work that way or not.

---

<div class="post-metadata">

**Author:** ![Paffciu](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@Paffciu](https://discuss.dvc.org/u/Paffciu)\
**Post date:** [January 13, 2021, 10:38am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/14 "2021-01-13T10:38:07Z")

</div>

@htutlynn that is because cache is downloaded for the current project version that is in repository. So, in order to download cache for older `data` version, you need first to `git checkout` its revision and only after that, use `dvc pull`.

---

<div class="post-metadata">

**Author:** ![htutlynn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@htutlynn](https://discuss.dvc.org/u/htutlynn)\
**Post date:** [January 13, 2021, 10:41am UTC](https://discuss.dvc.org/t/cant-go-to-former-version-of-dataset-with-dvc-checkout/615/15 "2021-01-13T10:41:35Z")

</div>

@Paffciu , Oh, that makes everything clear. Thanks for the help!
