Dvc: Error when using target plots file in Windows

Created on 5 Oct 2020  路  5Comments  路  Source: iterative/dvc

Bug Report

I have stage train_image_classifier in my dvc.yaml:

  train_image_classifier:
    cmd: python -m image_text_classification.classification.image
    deps:
    - data/images/train
    - data/images/val
    - image_text_classification/classification/image.py
    metrics:
    - metrics/image.json:
        cache: false
    plots:
    - plots/image.csv:
        cache: false
    outs:
    - snapshots/image/:
        cache: false
    - snapshots/image_best.h5

As you can see, I have defined one plots file: plots/image.csv. But when I try to do dvc plots show or dvc plots diff with this file specified as a target, I get the same error: ERROR: unexpected error - 'plots/image.csv'. Here is the output with the -v option used:

$ dvc plots show plots/image.csv -v
2020-10-05 19:06:26,974 DEBUG: Check for update is enabled.
2020-10-05 19:06:27,000 DEBUG: Trying to spawn '['daemon', '-q', 'updater']'
2020-10-05 19:06:29,897 DEBUG: Spawned '['daemon', '-q', 'updater']'
2020-10-05 19:06:31,137 ERROR: unexpected error - 'plots/image.csv'
------------------------------------------------------------
Traceback (most recent call last):
  File "dvc\main.py", line 76, in main
  File "dvc\command\plots.py", line 56, in run
  File "dvc\command\plots.py", line 86, in _func
  File "dvc\repo\plots\__init__.py", line 88, in show
  File "dvc\repo\plots\__init__.py", line 88, in <genexpr>
KeyError: 'plots/image.csv'
------------------------------------------------------------

Usually I use Git Bash but when I switch to PowerShell and use plots\image.csv as file path instead (i.e. use backslash), everything works just fine: dvc plots show plots\image.csv
But when I use PowerShell and use .\plots\image.csv, which is although right in PowerShell, there is the same error again:

dvc plots show .\plots\image.csv -v
2020-10-05 19:11:41,195 DEBUG: Check for update is enabled.
2020-10-05 19:11:41,226 DEBUG: Trying to spawn '['daemon', '-q', 'updater']'
2020-10-05 19:11:44,136 DEBUG: Spawned '['daemon', '-q', 'updater']'
2020-10-05 19:11:45,377 ERROR: unexpected error - '.\\plots\\image.csv'
------------------------------------------------------------
Traceback (most recent call last):
  File "dvc\main.py", line 76, in main
  File "dvc\command\plots.py", line 56, in run
  File "dvc\command\plots.py", line 86, in _func
  File "dvc\repo\plots\__init__.py", line 88, in show
  File "dvc\repo\plots\__init__.py", line 88, in <genexpr>
KeyError: '.\\plots\\image.csv'
------------------------------------------------------------

Please provide information about your setup

I use Windows 10 and Git Bash for my terminal. So, as you can see, all paths in dvc.yaml use forward slashes. I need it like this to use the same DVC project on Ubuntu because DVC on Ubuntu doesn't like backslashes very much. But it seems like, vice versa, there are some errors caused by using forward slashes in Windows setup.

Output of dvc version:

$ dvc version
DVC version: 1.8.1 (exe)
---------------------------------
Platform: Python 3.7.9 on Windows-10-10.0.18362-SP0
Supports: azure, gdrive, gs, hdfs, http, https, s3, oss, webdav, webdavs
Cache types: hardlink
Cache directory: NTFS on C:\
Workspace directory: NTFS on C:\
Repo: dvc, git

Additional Information (if any):

It's interesting that dvc metrics doesn't seem to have this bug. Apparently, paths are processed more correctly there.

awaiting response bug p2-medium research windows

Most helpful comment

Hey, @pared. Sorry for the delay. I see you don't need my help anymore :) But yeah, I can confirm the issue is fixed. Thanks!

All 5 comments

@sudoandros
We found the bug that might be responsible for this issue.
It is fixed in #4762
Could you try out installing from master and verifying whether the problem still occurs?
If not, the fix will be in next release. (current is 1.9.0).

For the record: 1.9.1 is out with the fix. exe installer will be available https://github.com/iterative/dvc/releases/tag/1.9.1 in a few minutes.

Closing for now.

Hey, @pared. Sorry for the delay. I see you don't need my help anymore :) But yeah, I can confirm the issue is fixed. Thanks!

@sudoandros I am glad to hear that!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmpetrov picture dmpetrov  路  3Comments

shcheklein picture shcheklein  路  3Comments

robguinness picture robguinness  路  3Comments

jorgeorpinel picture jorgeorpinel  路  3Comments

mfrata picture mfrata  路  3Comments