-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Change conda env validity checking to activate and run Python #48552
base: master
Are you sure you want to change the base?
Change conda env validity checking to activate and run Python #48552
Conversation
Signed-off-by: Peter Wang <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to deactivate it afterwards?
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 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 <[email protected]>
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 <[email protected]>
Signed-off-by: Peter Wang <[email protected]>
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 <[email protected]>
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.
@rynewang green now
Why are these changes needed?
Currently, we validate conda environments by checking the output of
conda info --json
to 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/environment
but 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
None
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.