mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.89k stars 353 forks source link

Broken PATH with `run fish` #2232

Open jonashaag opened 1 year ago

jonashaag commented 1 year ago

Troubleshooting docs

Search tried in issue tracker

-

Latest version of Mamba

Tried in Conda?

Reproducible with Conda

Describe your issue

When using fish as shell and running

micromamba shell

or

micromamba run fish

or

conda run --no-capture-output fish

the PATH in the newly opened fish shell has the environment's PATH somewhere towards the end, eg. after Homebrew. In the bash script that's generated as part of micromamba run, the PATH is correct, so there is something going on in the fish initialization that moves things in the PATH.

cc @YYYasin19

mamba info / micromamba info

No response

Logs

No response

environment.yml

No response

~/.condarc

No response

jonashaag commented 1 year ago

I think this will also be a problem if you have any lines like

export PATH="/opt/homebrew/bin:$PATH"  # recommended by Homebrew

in your ~/.bashrc/~/.zshrc. So it is not fish-specific.

Do we have any zsh/bash users here that could share how they set up their paths?

To reproduce, do

micromamba shell -n someenv
# or (equivalent)
micromamba run -n someenv $SHELL

and have a look at

echo $PATH

is the env bin first in $PATH? For me I'm getting

echo $PATH
/Users/j/micromamba/condabin ... /opt/homebrew/sbin /opt/homebrew/bin /Users/j/micromamba/envs/mamba-dev/bin /usr/local/bin ...
jonashaag commented 1 year ago

@pavelzw @AdrianFreundQC what shells are you using? Could you give this a try with the latest Micromamba release?

pavelzw commented 1 year ago

For me, I'm getting ... /opt/homebrew/bin /opt/homebrew/bin /Users/pavel/micromamba/envs/someenv/bin ... probably because I have eval "$(/opt/homebrew/bin/brew shellenv)" somewhere in my oh-my-zsh custom scripts that are loaded during the shell initialization.