Micromaba linking incorrect binary in FHS enviroment after upgrade

Hi there! Nix newcomer. I’ve been using micromaba for a bit through a nix shell.

Note this issue started after an upgrade. I had allready deleted my previous channel generation by the time I noticed haha

Definition is nearly identical to that posted in the python wiki post on micromamaba.

{ pkgs ? import <nixpkgs> {}}:
let
  fhs = pkgs.buildFHSUserEnv {
    name = "my-fhs-environment";

    targetPkgs = _: [
	  pkgs.which
      pkgs.micromamba
    ];

    profile = ''
      set -e
      eval "$(micromamba shell hook --shell=posix)"
      export MAMBA_ROOT_PREFIX=${builtins.getEnv "PWD"}/.mamba
      set +e
    '';
  };
in fhs.env

note the reason I include the which package in this shell is to use the R language with micromamba.

When I run nix-shell everything starts up fine but the moment I try to run any micromamba command I get the following error:

bash: /nix/store/r1m1ii09z82wv07ivb00jz2iz2pxmbc9-micromamba-1.5.8/bin/micromamba: No such file or directory

I’m 99% sure the hash here is for my old version of micromamba. Running

find /nix/store | grep micromamba

yields the following result (among others):

/nix/store/nf1jd8czw9kspasnpck8aqq8kmc2x0pz-micromamba-1.5.8/bin/micromamba

So to my untrained eye it seems that when I upgraded the hash for micromamba changed but something getting linked in the micromamba execution finding this binary is pulling an old version. Not sure this is a nix problem as much as a micromamba one. With that in mind any help figuring out how to get it working again would be appreciated!!

Thanks in advance :slight_smile:

It smells to me like micromamba might be storing its path on-disk and using that instead of the one given via $PATH.

Hey thanks @Atemu! You were totally right.

I literally ended up running

grep -r r1m1ii09z82wv07ivb00jz2iz2pxmbc9 .

on my home directory just to see if I could find the place it was being stored. Luckily I didn’t have to wait long because it tuns out I had a .bashrc file with a micromamba init instructions referencing my old hash! Looked like this


# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
export MAMBA_EXE='/nix/store/r1m1ii09z82wv07ivb00jz2iz2pxmbc9-micromamba-1.5.8/bin/micromamba';
export MAMBA_ROOT_PREFIX='/home/carter/micromamba';
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__mamba_setup"
else
    alias micromamba="$MAMBA_EXE"  # Fallback on help from mamba activate
fi
unset __mamba_setup
# <<< mamba initialize <<<

After deleting (or in my case just moving) this file, running my nix shell again made a new .bashrc with the updated hash. Then after ensuring my bash shell was evaluating that micromamba is once again working. :call_me_hand:

1 Like