Change conda env validity checking to activate and run Python#48552
Conversation
Signed-off-by: Peter Wang <peter.wang9812@gmail.com>
|
cc @jjyao |
| Check if the given conda environment exists and is valid. | ||
| We try to `conda activate` it and check that python is runnable | ||
| """ | ||
| activate_cmd = get_conda_activate_commands(conda_env_name) + ["python", "--version"] |
There was a problem hiding this comment.
Do we need to deactivate it afterwards?
There was a problem hiding this comment.
I don't believe so, because conda activate sets environment variables and other things that aren't global state, which will be reset when the subprocess exits.
However, I did recently do some thinking about it, and I think conda activate does a lot of shell-specific things, so I've changed it to execute in a shell.
Signed-off-by: Peter Wang <peter.wang9812@gmail.com>
|
Can you also update unit tests? I think this test will now fail (changed error msg) |
…se_conda_env_without_list Signed-off-by: Peter Wang <peter.wang9812@gmail.com>
Signed-off-by: Peter Wang <peter.wang9812@gmail.com>
|
Oops, I guess I didn't notice that! I've made the change. Sorry for the delay. |
…se_conda_env_without_list Signed-off-by: Peter Wang <peter.wang9812@gmail.com>
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
|
…oject#48552) Signed-off-by: Peter Wang <peter.wang9812@gmail.com> Signed-off-by: kaihsun <kaihsun@anyscale.com>
…oject#48552) Signed-off-by: Peter Wang <peter.wang9812@gmail.com>
…oject#48552) Signed-off-by: Peter Wang <peter.wang9812@gmail.com>
…ray-project#48552)" This reverts commit d9e27ab. Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com>
Why are these changes needed?
Currently, we validate conda environments by checking the output of
conda info --jsonto see if the environment is the list. Sometimes, one might install conda environments on some filesystem mounted across multiple machines. These environments can be activated with the absolute path:conda activate /path/to/environmentbut don't show up under the local conda installation'sconda info --json. I figure that what we really care about is that one can activate the environment and run Python in it, as that is what the RuntimeEnv plugin ultimately does, so this is what the check has become.Related issue number
Closes #50720
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.