-
Notifications
You must be signed in to change notification settings - Fork 94
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
Cylc to ignore PYTHONPATH: Use CYLC_PYTHONPATH for custom Python for Cylc #5727
Conversation
7df4dc2
to
e52ffcd
Compare
I've put this back to draft - I have something else to try! |
e52ffcd
to
03a64e5
Compare
LGTM; the tests are failing as a few Manual testing is ok for this, but a basic automated test is possible, put this code in a function, then monkeypatch
Will need docs too, but should run this by @hjoliver first, explanation:
|
I had considered this - I'll do it. Existing test failures seem to be caused by the print statements I left in the new code. |
@hjoliver Please confirm that you are happy with this approach. 😄 |
cylc/flow/etc/tutorial/cylc-forecasting-workflow/etc/python-job.settings
Outdated
Show resolved
Hide resolved
Hmmm:
https://github.com/cylc/cylc-flow/actions/runs/6315139062/job/17147002345?pr=5727#step:7:19 This is in a task's job.err section where it was raised from I think this suggests that the logic is removing the standard library from The previous diff (replacing |
fb77004
to
f0389e2
Compare
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.
Here's how I tested:
$ # create a virtual environment with an incompatible version of psutil
$ virtualenv venv
$ . venv/bin/activate
$ pip install psutil==4
$ # replicate the bug
$ conda activate cylc.dev
$ PYTHONPATH=venv/lib/python3.9/site-packages/ cylc vip generic -N
...
2023-10-16T12:02:07Z ERROR - Workflow shutting down - PluginError: Error in plugin cylc.main_loop.auto_restart
VersionConflict: (psutil 4.4.2 (/var/tmp/tmp.f8Khmjq2Dp/create/lib/python3.9/site-packages),
Requirement.parse('psutil>=5.6.0'))
$ # verify the fix
$ git -C ~/cylc-flow checkout wxtim/feature.cache_pythonpath
$ PYTHONPATH=venv/lib/python3.9/site-packages/ cylc vip generic -N
...
▪ ■ Cylc Workflow Engine 8.3.0.dev
██ Copyright (C) 2008-2023 NIWA
▝▘ & British Crown (Met Office) & Contributors
...
$ # all good!
We could do with an entry in the references/changes section of cylc-doc explaining the problem and introducing the CYLC_PYTHONPATH workaround. |
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.
Does this close #5124?
cylc/flow/etc/tutorial/cylc-forecasting-workflow/etc/python-job.settings
Outdated
Show resolved
Hide resolved
There is no specification for this behaviour written in the PR which is making it difficult to understand what is supposed to be happening |
@hjoliver , and
Fair Point:
What I am now unclear on is whether I want to save the original |
Yes. Very simple:
And nothing else!
No, there is no reason to do this. We are not changing any environment variables, only |
b0fd9a0
to
1d78914
Compare
Add CYLC_PYTHONPATH items to sys.path
1d78914
to
af0b92f
Compare
Co-authored-by: Hilary James Oliver <hilary.j.oliver@gmail.com>
cylc/flow/etc/tutorial/cylc-forecasting-workflow/etc/python-job.settings
Outdated
Show resolved
Hide resolved
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
…b.settings Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
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.
🎉
All comments addressed, two other approvals.
Closes #5124
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users?.?.x
branch.