iterative / dvc

🦉 ML Experiments and Data Management with Git
https://dvc.org
Apache License 2.0
13.61k stars 1.18k forks source link

ERROR: failed to pull data from the cloud - Checkout failed for following targets: #9653

Closed thekevinscott closed 1 year ago

thekevinscott commented 1 year ago

Bug Report

Description

On Github Actions, I'm receiving the following error message during a dvc pull (the full log is here):

2023-06-22T15:47:53.8024770Z dvc.exceptions.CheckoutError: Checkout failed for following targets:
2023-06-22T15:47:53.8026096Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/deblurring/64/group1-shard1of6.bin
2023-06-22T15:47:53.8027090Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/deblurring/64/group1-shard5of6.bin
2023-06-22T15:47:53.8028055Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/deblurring/64/group1-shard2of6.bin
2023-06-22T15:47:53.8029031Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/enhancement/64/group1-shard1of4.bin
2023-06-22T15:47:53.8030027Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/enhancement/256/group1-shard1of4.bin
2023-06-22T15:47:53.8030981Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/64/group1-shard2of6.bin
2023-06-22T15:47:53.8031924Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/64/group1-shard4of6.bin
2023-06-22T15:47:53.8032902Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/64/group1-shard5of6.bin
2023-06-22T15:47:53.8033864Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/64/group1-shard1of6.bin
2023-06-22T15:47:53.8034807Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/256/group1-shard6of6.bin
2023-06-22T15:47:53.8047775Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/64/group1-shard6of6.bin
2023-06-22T15:47:53.8049024Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/256/group1-shard5of6.bin
2023-06-22T15:47:53.8050010Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/256/group1-shard2of6.bin
2023-06-22T15:47:53.8050973Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/256/group1-shard4of6.bin
2023-06-22T15:47:53.8051949Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/denoising/256/group1-shard1of6.bin
2023-06-22T15:47:53.8052920Z /home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/deraining/64/group1-shard3of4.bin
2023-06-22T15:47:53.8053476Z Is your cache up to date?
2023-06-22T15:47:53.8054014Z <https://error.dvc.org/missing-files>

It appears that a subset of files fails to be pulled.

Things I've tried:

Reproduce

I'm not quite sure how to reproduce, as this is only happening on Github Actions. Here is a sample run where it happens. I cannot reproduce locally.

Environment information

Output of dvc doctor:

2023-06-22T15:41:00.9579273Z ##[group]Run dvc doctor
2023-06-22T15:41:00.9579679Z dvc doctor
2023-06-22T15:41:00.9638865Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail ***0***
2023-06-22T15:41:00.9639320Z env:
2023-06-22T15:41:00.9639648Z   TF_CPP_MIN_LOG_LEVEL: 2
2023-06-22T15:41:00.9640091Z   BROWSERSTACK_USERNAME: ***-GitHubAction
2023-06-22T15:41:00.9640545Z   BROWSERSTACK_ACCESS_KEY: ***
2023-06-22T15:41:00.9640964Z   BROWSERSTACK_PROJECT_NAME: UpscalerJS
2023-06-22T15:41:00.9641722Z   BROWSERSTACK_BUILD_NAME: [creating-maxim-models] Commit 9970243: Add new Maxim models:

- Deblurring
- Denoising
- Deraining
- Dehazing
  - Indoor
  - Outdoor
- Low Light Enhancement
- Retouching [Workflow: 3511]
2023-06-22T15:41:00.9642397Z ##[endgroup]
2023-06-22T15:41:01.5753054Z DVC version: 3.1.0 (***args.pkg***)
2023-06-22T15:41:01.5753975Z -------------------------------
2023-06-22T15:41:01.5755086Z Platform: Python 3.10.8 on Linux-5.15.0-1040-azure-x86_64-with-glibc2.35
2023-06-22T15:41:01.5755647Z Subprojects:
2023-06-22T15:41:01.5756062Z    
2023-06-22T15:41:01.5763663Z Supports:
2023-06-22T15:41:01.5764845Z    azure (adlfs = 2023.4.0, knack = 0.10.1, azure-identity = 1.13.0),
2023-06-22T15:41:01.5765960Z    gdrive (pydrive2 = 1.15.4),
2023-06-22T15:41:01.5766492Z    gs (gcsfs = 2023.6.0),
2023-06-22T15:41:01.5767538Z    hdfs (fsspec = 2023.6.0, pyarrow = 12.0.1),
2023-06-22T15:41:01.5768272Z    http (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),
2023-06-22T15:41:01.5769371Z    https (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),
2023-06-22T15:41:01.5769944Z    oss (ossfs = 2021.8.0),
2023-06-22T15:41:01.5770881Z    s3 (s3fs = 2023.6.0, boto3 = 1.26.76),
2023-06-22T15:41:01.5771417Z    ssh (sshfs = 2023.4.1),
2023-06-22T15:41:01.5772460Z    webdav (webdav4 = 0.9.8),
2023-06-22T15:41:01.5773008Z    webdavs (webdav4 = 0.9.8),
2023-06-22T15:41:01.5773880Z    webhdfs (fsspec = 2023.6.0)
2023-06-22T15:41:01.5774406Z Config:
2023-06-22T15:41:01.5775302Z    Global: /home/runner/.config/dvc
2023-06-22T15:41:01.5775835Z    System: /etc/xdg/dvc
2023-06-22T15:41:01.5777114Z Cache types: <https://error.dvc.org/no-dvc-cache>
2023-06-22T15:41:01.5777704Z Caches: local
2023-06-22T15:41:01.5778601Z Remotes: gdrive, s3, gdrive
2023-06-22T15:41:01.5779216Z Workspace directory: ext4 on /dev/sdb1
2023-06-22T15:41:01.5780114Z Repo: dvc, git
2023-06-22T15:41:01.5780824Z Repo.site_cache_dir: /var/tmp/dvc/repo/024b6be4ceeb4a42ecb120da7fbc6489

I'd be happy to provide any other information for help in debugging this. I'm not sure of the best way to troubleshoot as the issue only seems to appear in Github Actions.


UPDATE

One additional thing that might be useful is, there are three remotes associated with this repo:

The reason for the two gdrive remotes is so that users can clone the repo and easily pull models (it's an open source library and gdrive is the default remote), but also to enable CI integration (which afaik requires a service account).

That said, I've confirmed locally that pulling from the service account works successfully. Just not in the Github Actions session for some reason.

efiop commented 1 year ago

Looks like it is complaining that some cache files are corrupted, deletes them and then fails because of it. Is anything strange about your setup? Could you show your dvc config --list (make sure to censor stuff if there is anything private there). Is this a shared machine with a shared dvc cache maybe?

thekevinscott commented 1 year ago

Thanks for the response, @efiop.

Is anything strange about your setup?

Maybe the two gdrive remotes (one service account, one not)? I'm not sure if that's standard practice for open source projects that need to enable CI.

Nothing else seems strange that I can think of.

Could you show your dvc config --list

(I'm not sure what here is sensitive, so I'll be overly conservative)

remote.gdrive.url=gdrive://<GDRIVE_URL>
remote.gdrive.gdrive_use_service_account=false
remote.gdrive.gdrive_acknowledge_abuse=true
remote.s3.url=s3://<PATH_ON_S3>
remote.gdrive-service-account.url=gdrive://<GDRIVE_URL>
remote.gdrive-service-account.gdrive_use_service_account=true
core.remote=gdrive
core.autostage=true

Is this a shared machine with a shared dvc cache maybe?

I don't believe so. It's using whatever container Github Actions provides, which I believe is not a shared machine (or it may be shared but I assume things run in containers). Is there a way to determine whether the dvc cache would be shared more broadly?

I was able to SSH into the machine, and I manually deleted .dvc/cache (which I think is the cache folder?) along with .dvc/tmp and reran the command. I got the same error - looks like the same missing files, so at least it's consistent.

dberenbaum commented 1 year ago

@thekevinscott Since this just came up in #9640, is there any chance the failures are because your Github runner ran out of space?

thekevinscott commented 1 year ago

That's a pretty interesting thought.

df -h:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        84G   69G   15G  83% /
tmpfs           3.4G  172K  3.4G   1% /dev/shm
tmpfs           1.4G  1.1M  1.4G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sdb15      105M  6.1M   99M   6% /boot/efi
/dev/sda1        14G  4.1G  9.0G  31% /mnt
tmpfs           694M   12K  694M   1% /run/user/1001

Running du -h reports 11G. That's certainly close to the 14G limit, but I think it still leaves some wiggle room.

efiop commented 1 year ago

@thekevinscott Do you mix 2.x and 3.x?

Original log is from gdrive, right?

efiop commented 1 year ago

. I got the same error - looks like the same missing files, so at least it's consistent.

That doesn't sound good, seems like dvc thinks that the files it is downloading from your gdrive remote are corrupted. We are currently having some problems with gdrive remotes on 3.x, that might be related (maybe it thinks that these files are using the new hash while they don't) https://github.com/iterative/dvc-gdrive/issues/29

Could you try pinning to 2.x and see if that fixes it?

thekevinscott commented 1 year ago

Original log is pulling from gdrive, yes.

For your first question - you're asking if I'm using different DVC versions? I'm using whichever version is being installed from pip which appears to be 3.x

thekevinscott commented 1 year ago

. I got the same error - looks like the same missing files, so at least it's consistent.

That doesn't sound good, seems like dvc thinks that the files it is downloading from your gdrive remote are corrupted. We are currently having some problems with gdrive remotes on 3.x, that might be related (maybe it thinks that these files are using the new hash while they don't) https://github.com/iterative/dvc-gdrive/issues/29

Could you try pinning to 2.x and see if that fixes it?

Sure thing, I'll give this a shot tomorrow and report back. Any particular 2.x version or is the latest good?

skshetry commented 1 year ago

Hi, can you try installing pydrive2==1.16 with dvc==3 to see if that fixes the issue?

thekevinscott commented 1 year ago

Thanks all! It is almost certainly a versioning issue.

The files were added (via dvc add) locally with dvc==2.45.1. Github Actions was using the latest dvc which I believe was a 3.x.

I ran two experiments:

So, presumably, because the models were added locally with a dvc==2.x, they fail to be pulled on Github Actions because dvc==3.x. Running with dvc==2.x on Github Actions works, and running with dvc==3.x fails.

I assume then the next step is to follow the instructions here on upgrading from 2.x to 3.x, and re-add the models using the correct file hashing format?

skshetry commented 1 year ago

@thekevinscott, can you try with dvc==3.2.1?

thekevinscott commented 1 year ago

@thekevinscott, can you try with dvc==3.2.1?

Sure I can try that. Should I also pin pydrive2?

skshetry commented 1 year ago

No, that should not be needed. dvc 3.2.1 requires pydrive2>=1.16.

skshetry commented 1 year ago

I see that those files are now downloaded, but says some files are corrupted (and gets deleted as a result which most likely fails the checkout).

thekevinscott commented 1 year ago

I see that those files are now downloaded, but says some files are corrupted (and gets deleted as a result which most likely fails the checkout).

Yes, although the error message appears slightly differently (appears to be complaining about the whole model folder now, and not just the individual corrupted model pieces)

https://github.com/thekevinscott/UpscalerJS/actions/runs/5356228232/jobs/9715490197#step:5:1

thekevinscott commented 1 year ago

Should I hold off following the steps in the upgrade guide for troubleshooting purposes? (I assume once I upgrade, I won't be able to reproduce the issue.)

This is an open source project so I'm not under any sort of time rush to fix if it's helpful to you all to leave it in a broken state, but I assume the fix for me is following the upgrade guide to get things to 3.x.

WilliamHarvey97 commented 1 year ago

I had this issue. On my side there was a problem with a cache folder. I deleted rm -r /Library/Caches/dvc/ (I'm on macos) otherwise try deleting rm -r /var/caches/dvc on linux.

I suspect this occured to me while switching between branches and dvc v2 and v3.

efiop commented 1 year ago

@thekevinscott Does the latest dvc version work for you? We've changed some stuff to not share internal cache between major versions.

gtebbutt commented 1 year ago

I'm seeing the same issue, persisting on 3.6.0 (at least on a machine that I just upgraded to that version after seeing it come up on 3.5.1), and have intermittently seen it back when all our machines were on v2 as well.

We use an S3 remote, but have a sync task set up to duplicate that entire bucket across to a read only bucket on GCP (to avoid repeatedly paying egress costs when pulling data to servers on GCP).

Root cause seems to be pulling from the secondary remote before the sync task has had a chance to run. On the first attempt dvc pull shows:

WARNING: Some of the cache files do not exist neither locally nor on remote. Missing cache files:

But on all subsequent attempts (even after the buckets have replicated successfully) it fails with:

ERROR: failed to pull data from the cloud - Checkout failed for following targets:

Running on a freshly cloned copy of the repo seems to work fine, so I'm assuming something in the state of the original copy of the repo is getting messed up by trying to pull when the files are missing from the cloud, and then it's not successfully re-checking to see if they've appeared on subsequent runs?

dberenbaum commented 1 year ago

Possibly related: https://github.com/iterative/dvc/issues/9651 https://github.com/iterative/dvc/issues/9730

Is it possible that once fetching/pulling data fails once, DVC never tries to pull it again?

asiron commented 1 year ago

could be related to #9826

pmrowla commented 1 year ago

Closing this as duplicate of https://github.com/iterative/dvc/issues/9651

This should be resolved in the latest DVC release (3.14.0 or later). In github actions CI you should not need to do anything other than updating DVC.

On non-CI machines (for @gtebbutt and @WilliamHarvey97) you will need to remove the Repo.site_cache_dir folder (from dvc doctor) after updating DVC and then retry your pull

rm -r /var/tmp/dvc/repo/...
dvc pull

If you still see this issue after updating and clearing the site cache feel free to re-open this ticket.

thekevinscott commented 1 year ago

Still seeing this error for 3.14.0:


...

2023-08-11 01:56:00,558 DEBUG: failed to create '/home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/deraining/64/group1-shard3of4.bin' from '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/4d/b6e95347a959188b928124f6184c43' - [Errno 2] No such file or directory: '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/4d/b6e95347a959188b928124f6184c43'
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 331, in transfer
    _try_links(
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 273, in _try_links
    _link(link, from_fs, from_path, to_fs, to_path)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 62, in _link
    func(from_path, to_path)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/base.py", line 381, in link
    return self.fs.link(from_info, to_info)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/local.py", line 160, in link
    if self.size(path1) == 0:
  File "/home/runner/.local/lib/python3.10/site-packages/fsspec/spec.py", line 680, in size
    return self.info(path).get("size", None)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/local.py", line 42, in info
    return self.fs.info(path)
  File "/home/runner/.local/lib/python3.10/site-packages/fsspec/implementations/local.py", line 87, in info
    out = os.stat(path, follow_symlinks=False)
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/4d/b6e95347a959188b928124f6184c43'

2023-08-11 01:56:00,559 DEBUG: failed to create '/home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/enhancement/64/group1-shard1of4.bin' from '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/2c/a968fedce6c3ae699d6321af343243' - [Errno 2] No such file or directory: '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/2c/a968fedce6c3ae699d6321af343243'
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 331, in transfer
    _try_links(
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 273, in _try_links
    _link(link, from_fs, from_path, to_fs, to_path)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 62, in _link
    func(from_path, to_path)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/base.py", line 381, in link
    return self.fs.link(from_info, to_info)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/local.py", line 160, in link
    if self.size(path1) == 0:
  File "/home/runner/.local/lib/python3.10/site-packages/fsspec/spec.py", line 680, in size
    return self.info(path).get("size", None)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/local.py", line 42, in info
    return self.fs.info(path)
  File "/home/runner/.local/lib/python3.10/site-packages/fsspec/implementations/local.py", line 87, in info
    out = os.stat(path, follow_symlinks=False)
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/2c/a968fedce6c3ae699d6321af343243'

2023-08-11 01:56:00,559 DEBUG: failed to create '/home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models/enhancement/256/group1-shard1of4.bin' from '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/18/39d8b3fb0e5aa35e40d6e21508f57c' - [Errno 2] No such file or directory: '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/18/39d8b3fb0e5aa35e40d6e21508f57c'
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 331, in transfer
    _try_links(
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 273, in _try_links
    _link(link, from_fs, from_path, to_fs, to_path)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/generic.py", line 62, in _link
    func(from_path, to_path)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/base.py", line 381, in link
    return self.fs.link(from_info, to_info)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/local.py", line 160, in link
    if self.size(path1) == 0:
  File "/home/runner/.local/lib/python3.10/site-packages/fsspec/spec.py", line 680, in size
    return self.info(path).get("size", None)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc_objects/fs/local.py", line 42, in info
    return self.fs.info(path)
  File "/home/runner/.local/lib/python3.10/site-packages/fsspec/implementations/local.py", line 87, in info
    out = os.stat(path, follow_symlinks=False)
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/UpscalerJS/UpscalerJS/dvc-cache-dir-jun-23/18/39d8b3fb0e5aa35e40d6e21508f57c'

2023-08-11 01:56:01,373 DEBUG: Removing '/home/runner/work/UpscalerJS/UpscalerJS/models/maxim-experiments/models'
A       models/esrgan-thick/models/
A       models/maxim-denoising/models/
A       models/maxim-retouching/models/
A       models/maxim-deblurring/models/
A       models/esrgan-slim/models/
A       models/maxim-dehazing-outdoor/models/
A       models/default-model/models/
A       models/maxim-deraining/models/
A       models/esrgan-medium/models/
A       models/maxim-enhancement/models/
A       models/pixel-upsampler/models/
A       models/esrgan-legacy/models/
A       models/maxim-dehazing-indoor/models/
A       models/esrgan-experiments/models/
14 files added and 2114 files fetched
2023-08-11 01:56:01,754 ERROR: failed to pull data from the cloud - Checkout failed for following targets:
models/maxim-experiments/models
Is your cache up to date?
<https://error.dvc.org/missing-files>
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/dvc/commands/data_sync.py", line 31, in run
    stats = self.repo.pull(
  File "/home/runner/.local/lib/python3.10/site-packages/dvc/repo/__init__.py", line 64, in wrapper
    return f(repo, *args, **kwargs)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc/repo/pull.py", line 43, in pull
    stats = self.checkout(
  File "/home/runner/.local/lib/python3.10/site-packages/dvc/repo/__init__.py", line 64, in wrapper
    return f(repo, *args, **kwargs)
  File "/home/runner/.local/lib/python3.10/site-packages/dvc/repo/checkout.py", line 208, in checkout
    raise CheckoutError([relpath(out_path) for out_path in failed], stats)
dvc.exceptions.CheckoutError: Checkout failed for following targets:
models/maxim-experiments/models
Is your cache up to date?
<https://error.dvc.org/missing-files>

2023-08-11 01:56:01,767 DEBUG: Analytics is enabled.
2023-08-11 01:56:01,808 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmpyoi_he4b']'
2023-08-11 01:56:01,812 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmpyoi_he4b']'
Error: Process completed with exit code 1.

Pinning to 2.45.1 works fine and is what I've been doing to get around the bug. On my todo list was to upgrade my local dvc to 3 which I was assuming (hoping?) would resolve the version mismatch issues.

Don't necessarily want to keep this ticket open as I've found a workaround and will be upgrading locally soon, but I'm happy to reopen it if you'd like to debug it further.

thekevinscott commented 1 year ago

I realize I forgot to clear the cache in CI - let me do that and I'll report back with the results

thekevinscott commented 1 year ago

Same issue as above with cache cleared for 3.14.0.

https://github.com/thekevinscott/UpscalerJS/actions/runs/5831901238/job/15816243365?pr=842

efiop commented 1 year ago

@thekevinscott Seems related to https://github.com/iterative/dvc/issues/9733 . Could you try dvc 3.15.0, please?

thekevinscott commented 1 year ago

3.15.0 works like a charm! No errors.