From b44099367e5858d7c4ed331671b5b24d7514f911 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Thu, 3 Nov 2022 15:30:18 +0900 Subject: [PATCH] exp run: catch hydra import in 3.11 --- dvc/repo/experiments/run.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dvc/repo/experiments/run.py b/dvc/repo/experiments/run.py index 668d0582f..043f6cc51 100644 --- a/dvc/repo/experiments/run.py +++ b/dvc/repo/experiments/run.py @@ -1,8 +1,9 @@ import logging +import sys from typing import Dict, Iterable, Optional from dvc.dependency.param import ParamsDependency -from dvc.exceptions import InvalidArgumentError +from dvc.exceptions import DvcException, InvalidArgumentError from dvc.repo import locked from dvc.ui import ui from dvc.utils.cli_parse import to_path_overrides @@ -28,7 +29,12 @@ def run( Returns a dict mapping new experiment SHAs to the results of `repro` for that experiment. """ - from dvc.utils.hydra import to_hydra_overrides + try: + from dvc.utils.hydra import to_hydra_overrides + except ValueError: + if sys.version_info >= (3, 11): + raise DvcException("exp run is not supported in Python >= 3.11") + raise if run_all: entries = list(repo.experiments.celery_queue.iter_queued())