Skip to content

Commit

Permalink
Fix mypy when prepending $PYTHONPATH to sys.path
Browse files Browse the repository at this point in the history
  • Loading branch information
sumanthratna committed Jan 28, 2021
1 parent 8cb2451 commit b52fa07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/models/data/horovod/train_default_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import os
import sys

# this is need as e.g. Conda do not uses `PYTHONPATH` env var as pip or/and virtualenv
sys.path = os.getenv('PYTHONPATH').split(':') + sys.path
# this is needed because Conda does not use `PYTHONPATH` env var while pip and virtualenv do
PYTHONPATH = os.getenv('PYTHONPATH', '')
if ':' in PYTHONPATH:
sys.path = PYTHONPATH.split(':') + sys.path

from pytorch_lightning import Trainer # noqa: E402
from pytorch_lightning.callbacks import ModelCheckpoint # noqa: E402
Expand Down

0 comments on commit b52fa07

Please sign in to comment.