-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fixed PYTHONPATH for ddp test model #4528
Fixed PYTHONPATH for ddp test model #4528
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4528 +/- ##
======================================
Coverage 93% 93%
======================================
Files 129 129
Lines 9359 9359
======================================
Hits 8677 8677
Misses 682 682 |
tests/utilities/dist.py
Outdated
@@ -29,11 +29,10 @@ def call_training_script(module_file, cli_args, method, tmpdir, timeout=60): | |||
|
|||
# need to set the PYTHONPATH in case pytorch_lightning was not installed into the environment | |||
env = os.environ.copy() | |||
env['PYTHONPATH'] = f'{pytorch_lightning.__file__}:' + env.get('PYTHONPATH', '') | |||
env['PYTHONPATH'] = env.get('PYTHONPATH', '') + f'{pytorch_lightning.__file__}:' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why the self-file shall not be the first one... ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my setup, I installed pytorch-lightning and its dependencies. When test_model is launched as subprocess, it uses tests
module from the virtualenv instead of the local 'tests' as supposed (and PYTHONPATH
contains local pytorch-lightning
first)
@tchaton @awaelchli mind check on this DDP? |
@gianscarpe mind resolve conflicts? |
…torch-lightning into bugfix/3827_test_ddp_error
Yes, verified, this should be fine :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What does this PR do?
I found an issue related to PYTHONPATH env when launching test_ddp.py. In particular, the pytorch-lightning local directory should be placed before the installation directory to access
tests
directory locally. This solved the issue and tests now passFixes #3827
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Yes! I want to continue improving pytorch-lightning and cooperate!🙃