-
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
Investigate wrappers for environment activation #3704
Comments
The slow activate times for Conda really confuse me, what the heck is it doing? Well according to the code:
(1) should be quick, for (2) I cant see any So what's it actually doing? $ env > before
$ conda activate cylc8
$ env > after
$ diff before after
--- before 2020-07-22 23:27:46.000000000 +0100
+++ after 2020-07-22 23:27:53.000000000 +0100
@@ -8,19 +8,22 @@
GPG_TTY=/dev/ttys002
PWD=/Users/user/miniconda3
LOGNAME=user
+CONDA_PREFIX=/Users/user/miniconda3/envs/cylc8
HOME=/Users/user
LANG=en_GB.UTF-8
+CONDA_PROMPT_MODIFIER=(cylc8)
TMPDIR=/var/folders/rg/691l5s513_97d5s7ktr1rtt00000gn/T/
TERM=xterm-256color
_CE_CONDA=
USER=user
-CONDA_SHLVL=0
+CONDA_SHLVL=1
SHLVL=1
HOME_HOST=myhost
XPC_SERVICE_NAME=0
CONDA_PYTHON_EXE=/Users/user/miniconda3/bin/python
-PS1=\[\][\W] $\[\]
-PATH=/Users/user/miniconda3/condabin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/Users/user/bin:/Users/user/.user/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
+PS1=(cylc8) \[\][\W] $\[\]
+CONDA_DEFAULT_ENV=cylc8
+PATH=/Users/user/miniconda3/envs/cylc8/bin:/Users/user/miniconda3/condabin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/Users/user/bin:/Users/user/.user/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
+OLDPWD=/Users/user/miniconda3/condabin
TERM_PROGRAM=Apple_Terminal
_=/usr/local/opt/coreutils/libexec/gnubin/env
-OLDPWD=/Users/user/miniconda3/condabin Well wan't that a lot of ado about nothing! One would naturally assume you could cache this simple result?
I had a quick crack at using this Would have to delve a little deeper into I think this kind of approach would break is the ability to intelligently unset environment variables (which I think Conda does). Then there is the small matter of what happens if you call the script from an environment in which you have already activated a Conda environment? |
Summary of the problemThere are a few problems with
Conda PackThe wonderfully useful This activate script shows how minimal a functional This script:
Activate scriptsAny Conda package could bundle an activation script, however, few actually do, perhaps because conda-build actively discourages the use of activation scripts because:
Currently we don't have any dependencies which provide activation scripts. Also I would expect activation scripts on the whole are more likely to be used for configuring shells for interactive use? ConclusionOf the four items above we only actually need (2), consequently, because our Python entry points get created with the appropriate shebang we should be able to safely call our script using its absolute path without having to worry about environment activation. Proposal
|
Sounds reasonable (assuming you're right about |
Maybe worth for testing; will it work if the user calls conda activate anyway to his/her own environment? I think a few weeks ago we had a user with an error because he had the base env and cylc env? Might be worth testing that too. |
This is an annoying issue with activation (I hit it all the time) and a bug in the current wrapper script. If you already have an environment activated, If we skip activation the environments won't clash in this way (we call the Cylc executable with an absolute path, that script has a shebang to Python with an absolute path, Python loads the |
(Now: ditch activate). |
Optimistically b3, if we can, otherwise bump back. (Good to get tested as soon as possible). |
Conda environment activation is reputedly quite slow.
conda run
might address this in future, but doesn't yet? (and we can't use it in shared environments)This small project makes some impressive claims, we should take a look: exec wrappers. (from an offline comment: (it might just be sourcing the python interpreter which won't work for all cases)?)
The text was updated successfully, but these errors were encountered: