-
Notifications
You must be signed in to change notification settings - Fork 356
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
Discussion: (micro)mamba
should always be in PATH
#2577
Comments
fyi @pavelzw |
Does the shell function or the binary on |
The shell function takes priority. |
Also, I think the current shell initialization could be simplified further. We could just put At least for bash, zsh, ... |
In fact I don't think there is a user directory which is always gonna be on the Path on Unix, so we should add it to the Path in the initialization script. Not sure how I feel about automatically adding |
Is there any way to get rid of this intricate shell magic entirely? I find it highly opaque and thereby irritating and I am not aware of any other software which does such things. Adding If I understand correctly, the reason for this shell magic is that subprocesses cannot modify the parent shell's environment. Couldn't this be solved by making the primary executable a shell script, which takes care of activation / deactivation itself, but delegates everything else to the binary? Sorry if I'm completely clueless... |
@allefeld that's exactly how it's implemented, except that the shell script isn't an executable but a shell function Try https://github.com/prefix-dev/pixi it doesn't have these problems. But it is not fully compatible. |
@jonashaag I think the installation location of @allefeld As Jonas pointed out, you are pointing to the right limitation and way it is handled. |
I realize now that, contrary to my assumption, a shell script cannot change it's parent's environment either – so I'm guessing there's no way around the shell function in the general case. Good to know about Do you happen to know how VS Code handles conda / mamba / micromamba environments? Would it e.g. be a good idea to use |
PS: If I activate the environment, or use |
I think there is a bug in 1.4.9 with I think it should be fine to run VS Code like this. We run it from a Conda env in a complicated setup and it works fine |
Agreed, although then we should change the activation as follows:
|
But my main concerns are |
I'll try to come up with a well thought through "RFC" that takes into account backwards compatibility. |
The shell hook stuff also makes it super annoying to implement We have a CI runner, where, to set up |
@jonashaag |
Some thoughts: We've been building a high level CLI that calls It gets especially tricky if running in an environment that's not actually running a shell (eg; as a docker container) or if the shell keeps changing (eg; when building a docker image). To that end, it would be worth having an alternative activation/deactivation paradigm that relies on a fixed location being added to I've looked into the approach pixi uses and while we do something similar for invoking conda/mamba right now (running in a PTY and forking+mirroring) there are gotchas to think about when running in a pty if the intent is to have |
I am encountering the exact same problem trying to run Luckily, I found a StackOverflow answer here that provides an elegant solution. I believe this is a problem that could be easily rectified if it was documented properly in the docs. Perhaps the Miniforge install script could add a Docker option which adds a symlink to I also tried running
Dockerfile:
|
I'm here after several hours spread over a few days trying to troubleshoot problems installing and configuring micromamba. Much of that time was spent spinning because I did not understand that typing This leads me wonder: why does micromamba refer to both the executable and the shell function? is it essential they be the same word? I think would have understood the situation much sooner if, for example, |
The reason why micromamba needs a wrapper function is for modifying the current shell as explained in this issue. Your idea is worth considering, but note that giving it a different name would have the opposite of what OP advocates for: seamless fallback from shell function to executable. |
(This is another example of why I suggest to get rid of shell activation/integration entirely)
If you install Micromamba through http://micro.mamba.pm/install.sh it will be installed to
~/.local/bin/micromamba
. Not everyone has~/.local/bin
on theirPATH
and Micromamba is fine with this sincemicromamba foo
in the shell will not call themicromamba
binary but themicromamba
shell function instead.However if you use any other tool that wants to call Micromamba as a subprocess, eg. pre-commit, this will fail since Micromamba is not on the
PATH
. To users this is really confusing because if you don't know about the shell function you'd think that themicromamba
binary works fine, while it doesn't! (Only the shell function works, which has its own way to find the binary.)This also applies to Mamba.
I think we should make sure that
(micro)mamba
is always on thePATH
. Maybe we can emit a warning in the shell function if it isn't.The text was updated successfully, but these errors were encountered: