mamba-org / mamba

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

Mamba Initialization Block Placed in Wrong Location #2415

Open michaels10 opened 1 year ago

michaels10 commented 1 year ago

Troubleshooting docs

Search tried in issue tracker

yes

Latest version of Mamba

Tried in Conda?

Not applicable

Describe your issue

I am on an M1 Mac Studio; I had a prior conda install that I wanted to switch to mamba. I did the following:

  1. Run conda install mamba -n base -c conda-forge
  2. Run mamba init
  3. Restart terminal, find that mamba activate still does not work!
  4. mamba init modifies /Users/michaelsandler/.bash_profile -- but this is a Mac, so the default shell is zsh, not bash!
  5. I just copy pasted the changes from bash_profile to my .zshrc, which seems to be working fine.

mamba info / micromamba info

active environment : omnipose
    active env location : /Users/michaelsandler/miniconda3/envs/omnipose
            shell level : 2
       user config file : /Users/michaelsandler/.condarc
 populated config files : 
          conda version : 23.1.0
    conda-build version : not installed
         python version : 3.10.10.final.0
       virtual packages : __archspec=1=arm64
                          __osx=13.1=0
                          __unix=0=0
       base environment : /Users/michaelsandler/miniconda3  (writable)
      conda av data dir : /Users/michaelsandler/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/michaelsandler/miniconda3/pkgs
                          /Users/michaelsandler/.conda/pkgs
       envs directories : /Users/michaelsandler/miniconda3/envs
                          /Users/michaelsandler/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.1.0 requests/2.28.1 CPython/3.10.10 Darwin/22.2.0 OSX/13.1
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Logs

No response

environment.yml

No response

~/.condarc

No response

jonashaag commented 1 year ago
  1. Run conda install mamba -n base -c conda-forge

Note that it is not recommended to use this way of installation.

In any case the issue you are facing should be unrelated.

Did you run mamba init from a bash shell or from a zsh shell?

jonashaag commented 1 year ago

I just realized this

$ mamba init -h
usage: mamba init [-h] [--all] [--user] [--no-user] [--system] [--reverse] [--json] [-v] [-q] [-d] [shells ...]

Initialize conda for shell interaction.

Options:

positional arguments:
  shells         One or more shells to be initialized. If not given, the default value is 'bash' on unix and 'cmd.exe' on
                 Windows.

So it looks like this is expected and documented behaviour that's inherited from Conda. Did Conda initialize .zshrc when you set up Conda, contrary to the documentation?

michaels10 commented 1 year ago

Hi Jonah,

Re: Not recommended

I understand that it isn't recommended. However, I have existing conda environments that I didn't want to lose, and the installation instructions don't suggest a way to replace an extant conda installation without running that command; I spent a little time looking around for one and didn't find it. I'm certainly nowhere near confident enough with conda to play with uninstall commands like that, reinstalling environments wouldn't be a great use of time.

Re: Inherited from conda

FWIW, I believe I installed conda from brew and didn't run into such an issue. It does look like there are instructions for conda init under 'Manual Installation', somewhere among a bunch of other commands that aren't really relevant to this install.

I think this isn't so much a bug, as much as it is slightly-out-of-date docs.

jonashaag commented 1 year ago

Maybe Homebrew automatically sets up zsh.

If you could come up with a PR that improves the docs that would be highly appreciated!