-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot plot with windows paths syntax #8689
Comments
See my original comment where I provided a repro for a related issue. I have since renamed that repro to reflect its relationship to the current issue number 8689. Here's that repro again. It breaks a plot when there's a It is not an exhaustive reproduction for this now broader issue, but represents one way in which Windows paths can mess things up. WorkaroundHere's an updated, generalized workaround since I last commented over in the other issue. Supply all paths in See below for an example normalizing script, parameters file, and repl_path_in_params.py"""Replace Windows path separators with POSIX paths in configuration file."""
from pathlib import Path
from ruamel.yaml import YAML
PARAMS_FILE = "params.yaml"
DIRS_KEY = "dirs"
yaml = YAML()
yaml.indent(offset=2)
def main():
params = yaml.load(PARAMS_FILE)
params[DIRS_KEY] = repl_path(params[DIRS_KEY])
yaml.dump(params, PARAMS_FILE)
def repl_path(dirs_dict: dict[str, Path]):
"""Replace Windows path separator with POSIX separator."""
return {k: str(v).replace("\\", "/") for k, v in dirs_dict.items()}
if __name__ == "__main__":
main() params.yamldirs:
plot_new_fit_0: data/metrics/plots/new_fit_0.png
plot_new_fit_1: data/metrics/plots/new_fit_1.png
plot_new_fit_2: data/metrics/plots/new_fit_2.png
file_pipeline_metrics: data/metrics/tables/pipeline_metrics.json
other_params:
... dvc.yaml ...
metrics:
cmd: "<metrics_cmd>"
deps:
- ...
metrics:
- "${dirs.file_pipeline_metrics}"
plots:
- "${dirs.plot_new_fit_0}"
- "${dirs.plot_new_fit_1}"
- "${dirs.plot_new_fit_2}"
params:
- ...
... |
Thanks for the workaround @blakeNaccarato 🙏 |
The most tricky thing about this bug is that |
Was causing `parse` to silently file when trying to collect the sources. Fixes #8689 - Add `test_show_sources_with_native_os_path`. - Remove unnecessary OrderedDict usage in `load_sv`.
Was causing `parse` to silently file when trying to collect the sources. Fixes #8689 - Add `test_show_sources_with_native_os_path`. - Remove unnecessary OrderedDict usage in `load_sv`.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
Fixes #8689 - Add test_show_sources_with_native_os_path. - Remove unnecessary OrderedDict usage in load_sv.
`plots.show` returned `definitions` in native `nt` format but sources in `posixpath` format so the matching was failing. Closes #8689 - Add `test_show_plots_defined_with_native_os_path`.
`plots.show` returned `definitions` in native `nt` format but sources in `posixpath` format so the matching was failing. Closes #8689 - Add `test_show_plots_defined_with_native_os_path`.
`plots.show` returned `definitions` in native `nt` format but sources in `posixpath` format so the matching was failing. Closes #8689 - Add `test_show_plots_defined_with_native_os_path`.
`plots.show` returned `definitions` in native `nt` format but sources in `posixpath` format so the matching was failing. Closes #8689 - Add `test_show_plots_defined_with_native_os_path`.
Bug Report
Windows path syntax
I work on windows and tried to display some plots, here is my
dvc.yaml
file :Notice that my paths have a Windows syntax here.
If I run
dvc plots show -v --json
it outputs :Then if I replace
\
with/
in my paths like so :Now DVC is able to correctly display plots.
Expected
You would expect Windows path syntax to work on Windows
Environment information
Output of
dvc doctor
:$ dvc doctor
The text was updated successfully, but these errors were encountered: