From 7b64472ced732c6762978f2a3a844f6ef5261157 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Thu, 17 Sep 2020 14:37:49 +0200 Subject: [PATCH] fix lib paths after Wandb 0.10 (#3520) * try * try * drop 0.20 * drop 0.19.5 * -U * Fixed Horovod in CI due to wandb==0.10.0 sys.path modifications (#3525) Co-authored-by: Jirka Borovec * format * wb freeze * types Co-authored-by: Travis Addair --- .github/workflows/ci_test-full.yml | 2 +- .pyrightconfig.json | 3 ++- requirements/extra.txt | 2 +- tests/models/data/horovod/train_default_model.py | 9 +++++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_test-full.yml b/.github/workflows/ci_test-full.yml index 196869611c..1b606b35f6 100644 --- a/.github/workflows/ci_test-full.yml +++ b/.github/workflows/ci_test-full.yml @@ -83,7 +83,7 @@ jobs: run: | # python -m pip install --upgrade --user pip pip install --requirement requirements/base.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet --upgrade - HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install --requirement ./requirements/devel.txt --quiet --upgrade-strategy "only-if-needed" + HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install --requirement ./requirements/devel.txt --quiet --upgrade python --version pip --version pip list diff --git a/.pyrightconfig.json b/.pyrightconfig.json index 1dfa714532..41c90bbc35 100644 --- a/.pyrightconfig.json +++ b/.pyrightconfig.json @@ -33,7 +33,8 @@ "pytorch_lightning/trainer/lr_scheduler_connector.py", "pytorch_lightning/trainer/training_loop_temp.py", "pytorch_lightning/trainer/connectors/checkpoint_connector.py", - "pytorch_lightning/tuner" + "pytorch_lightning/tuner", + "pytorch_lightning/plugins" ], "reportMissingImports": false diff --git a/requirements/extra.txt b/requirements/extra.txt index c533b601c9..7ff0905ef5 100644 --- a/requirements/extra.txt +++ b/requirements/extra.txt @@ -4,7 +4,7 @@ neptune-client>=0.4.109 comet-ml>=3.1.12 mlflow>=1.0.0 test_tube>=0.7.5 -wandb>=0.8.21 +wandb>=0.8.21, <0.10.0 # higher version mess with system paths matplotlib>=3.1.1 # no need to install with [pytorch] as pytorch is already installed and torchvision is required only for Horovod examples horovod>=0.19.2 diff --git a/tests/models/data/horovod/train_default_model.py b/tests/models/data/horovod/train_default_model.py index ce12008a6f..1f9e6fe8ce 100644 --- a/tests/models/data/horovod/train_default_model.py +++ b/tests/models/data/horovod/train_default_model.py @@ -24,15 +24,20 @@ import sys try: import horovod.torch as hvd -except (ModuleNotFoundError, ImportError): +except ImportError: print('You requested to import Horovod which is missing or not supported for your OS.') PATH_HERE = os.path.abspath(os.path.dirname(__file__)) -PATH_ROOT = os.path.join(PATH_HERE, '..', '..', '..', '..') +PATH_ROOT = os.path.abspath(os.path.join(PATH_HERE, '..', '..', '..', '..')) sys.path.insert(0, os.path.abspath(PATH_ROOT)) from pytorch_lightning import Trainer # noqa: E402 from pytorch_lightning.callbacks import ModelCheckpoint # noqa: E402 + +# Move project root to the front of the search path, as some imports may have reordered things +idx = sys.path.index(PATH_ROOT) +sys.path[0], sys.path[idx] = sys.path[idx], sys.path[0] + from tests.base import EvalModelTemplate # noqa: E402 from tests.base.develop_pipelines import run_prediction # noqa: E402 from tests.base.develop_utils import set_random_master_port, reset_seed # noqa: E402