-
Notifications
You must be signed in to change notification settings - Fork 624
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
Include sys.path of ephemeral env in PYTHONPATH #7699
base: main
Are you sure you want to change the base?
Conversation
You might just be able to do something like |
A few issues with this that come to mind though I'm not certain on either:
|
I'm concerned that setting PYTHONPATH could have an impact on This was issue #5459 in the past. You have two environments, Base and Layer. The root cause of the problem is that Could a solution be to execute |
I've tried |
I just discovered that. 😢 jupyter lab must be executing the jupyter-lab script stub? |
Yeah there's something going on that I don't understand yet. |
And if I "fix" the jupyter-lab script stub to just use usr/bin/env python, a different error is produced. This is not going to play very well with environment layering, because jupyterlab is searching for its $prefix/share/jupyter/lab
|
This was the first thing I tried as well, using the ephemeral env's interpreter to execute
Both of these points make sense as well (verified the first, looking into the second now) |
This PR ensures that the sys.path of an ephemeral environment is included in the PYTHONPATH of spawned processes (useful in the case of executing external commands). This addresses issue #7647.
I tested this with the repro in the issue, i.e.:
An automated test is trickier — Jupyter doesn't have an interface for executing commands non-interactively (closest thing is
jupyter console
, which spawns a repl). Its runtime (ipython) does accept a-c
flag, but the issue doesn't manifest when using ipython — as such, a test wouldn't be effective. Open to thoughts on more rigorous test plans, I might be missing something!