-
Notifications
You must be signed in to change notification settings - Fork 372
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
Fix mamba init --no-user
#2324
Fix mamba init --no-user
#2324
Conversation
This merge makes changes similar to conda/conda#11949 to fix `mamba init` so that the `--no-user` flag actually has the intended effect of not changing a user's `.bashrc` or equivalent. Without this change, `--no-user` has no effect as was previously the case in conda, see: conda/conda#11948
I tested this locally by making a fresh install of mambaforge, then doing:
As expected, This behavior is needed in situations where we do not wish to have mambaforge activate automatically in a user's shell (e.g. because we have multiple conda or mambaforge installations available on an HPC system and shell scripts that call python scripts may revert back to the wrong conda base environment). A workaround has been to copy a user's |
Will this break backwards compat with older Conda versions? |
@jonashaag, I can test that but I don't believe so beyond the fact that the |
@jonashaag, yes, unfortunately with I don't see an obvious way to fix this for all conda versions. I will give it some thought but would appreciate suggestions. It is broken as written now so I don't think leaving it as it is would be a very desirable option, especially because I put the work into fixing |
Thanks for checking! I think just adding a Conda version check will be fine:
|
@jonashaag, do you have code somewhere for detecting the conda version? I didn't want to add any new dependencies for comparing versions but if you already have such a dependency, For now, I'm using the presence of |
This is fine IMO, actually it’s better than checking for version: checking for availability of a feature. Version numbers are just proxies for that. |
This is still broken with the `--no-user`, as noted, but at least newer versions of conda (>=23.1.0) will work as expected.
for_user = args.user | ||
if not (args.install and args.user and args.system): | ||
for_user = True | ||
if args.no_user: | ||
for_user = False |
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.
Okay, this is the block of code before #2249. So we'll behave as before if args.no_user
is present but things will work properly (including the --no-user
flag for newer versions where the argument is no longer there.
Thanks @jonashaag. I think we're on the same page. Let me know what you think at this point. |
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.
Awesome thanks so much!
This merge makes changes similar to
conda/conda#11949
to fix
mamba init
so that the--no-user
flag actually has the intended effect of not changing a user's.bashrc
or equivalent. Without this change,--no-user
has no effect as was previously the case in conda, see:conda/conda#11948