mamba-org / mamba

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

Win10 activate not working, init not working, name is not registered in conda env list #2519

Open GrigoriiTarasov opened 1 year ago

GrigoriiTarasov commented 1 year ago

Troubleshooting docs

How did you install Mamba?

Mambaforge

Search tried in issue tracker

activate not working, init not working, name is not registered in conda env list

Latest version of Mamba

Tried in Conda?

I do not have this problem with Conda, just with Mamba

Describe your issue

In git bash

mamba activate iterstrat

Run 'mamba init' to be able to run mamba activate/deactivate
and start a new shell session. Or use conda to activate/deactivate.
mamba init
no change     C:\ProgramData\mambaforge\Scripts\conda.exe
no change     C:\ProgramData\mambaforge\Scripts\conda-env.exe
no change     C:\ProgramData\mambaforge\Scripts\conda-script.py
no change     C:\ProgramData\mambaforge\Scripts\conda-env-script.py
no change     C:\ProgramData\mambaforge\condabin\conda.bat
no change     C:\ProgramData\mambaforge\Library\bin\conda.bat
no change     C:\ProgramData\mambaforge\condabin\_conda_activate.bat
no change     C:\ProgramData\mambaforge\condabin\rename_tmp.bat
no change     C:\ProgramData\mambaforge\condabin\conda_auto_activate.bat
no change     C:\ProgramData\mambaforge\condabin\conda_hook.bat
no change     C:\ProgramData\mambaforge\Scripts\activate.bat
no change     C:\ProgramData\mambaforge\condabin\activate.bat
no change     C:\ProgramData\mambaforge\condabin\deactivate.bat
no change     C:\ProgramData\mambaforge\Scripts\activate
no change     C:\ProgramData\mambaforge\Scripts\deactivate
no change     C:\ProgramData\mambaforge\etc\profile.d\conda.sh
no change     C:\ProgramData\mambaforge\etc\fish\conf.d\conda.fish
no change     C:\ProgramData\mambaforge\shell\condabin\Conda.psm1
no change     C:\ProgramData\mambaforge\shell\condabin\conda-hook.ps1
no change     C:\ProgramData\mambaforge\Lib\site-packages\xontrib\conda.xsh
no change     C:\ProgramData\mambaforge\etc\profile.d\conda.csh
no change     C:\Users\Lenovo\Documents\WindowsPowerShell\profile.ps1
no change     HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
No action taken.

mamba env list

# conda environments:
#
                      *  C:\ProgramData\Anaconda3
base                     C:\ProgramData\mambaforge
iterstrat                C:\ProgramData\mambaforge\envs\iterstrat
ts_neural                C:\ProgramData\mambaforge\envs\ts_neural

conda env list

# conda environments:
#
base                  *  C:\ProgramData\Anaconda3
                         C:\ProgramData\mambaforge
                         C:\ProgramData\mambaforge\envs\iterstrat
                         C:\ProgramData\mambaforge\envs\ts_neural
qt5_labeling             C:\Users\Lenovo\.conda\envs\qt5_labeling

conda activate iterstrat

EnvironmentNameNotFound: Could not find conda environment: iterstrat
You can list all discoverable environments with `conda info --envs`.

mamba info / micromamba info

active environment : C:\ProgramData\Anaconda3
    active env location : C:\ProgramData\Anaconda3
            shell level : 1
       user config file : C:\Users\Lenovo\.condarc
 populated config files : C:\ProgramData\mambaforge\.condarc
                          C:\Users\Lenovo\.condarc
          conda version : 23.1.0
    conda-build version : not installed
         python version : 3.10.10.final.0
       virtual packages : __archspec=1=x86_64
                          __win=0=0
       base environment : C:\ProgramData\mambaforge  (writable)
      conda av data dir : C:\ProgramData\mambaforge\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
                          https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : C:\ProgramData\mambaforge\pkgs
                          C:\Users\Lenovo\.conda\pkgs
                          C:\Users\Lenovo\AppData\Local\conda\conda\pkgs
       envs directories : C:\ProgramData\mambaforge\envs
                          C:\Users\Lenovo\.conda\envs
                          C:\Users\Lenovo\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/23.1.0 requests/2.28.2 CPython/3.10.10 Windows/10 Windows/10.0.19045
          administrator : False
             netrc file : None
           offline mode : False

Logs

mamba init
no change     C:\ProgramData\mambaforge\Scripts\conda.exe
no change     C:\ProgramData\mambaforge\Scripts\conda-env.exe
no change     C:\ProgramData\mambaforge\Scripts\conda-script.py
no change     C:\ProgramData\mambaforge\Scripts\conda-env-script.py
no change     C:\ProgramData\mambaforge\condabin\conda.bat
no change     C:\ProgramData\mambaforge\Library\bin\conda.bat
no change     C:\ProgramData\mambaforge\condabin\_conda_activate.bat
no change     C:\ProgramData\mambaforge\condabin\rename_tmp.bat
no change     C:\ProgramData\mambaforge\condabin\conda_auto_activate.bat
no change     C:\ProgramData\mambaforge\condabin\conda_hook.bat
no change     C:\ProgramData\mambaforge\Scripts\activate.bat
no change     C:\ProgramData\mambaforge\condabin\activate.bat
no change     C:\ProgramData\mambaforge\condabin\deactivate.bat
no change     C:\ProgramData\mambaforge\Scripts\activate
no change     C:\ProgramData\mambaforge\Scripts\deactivate
no change     C:\ProgramData\mambaforge\etc\profile.d\conda.sh
no change     C:\ProgramData\mambaforge\etc\fish\conf.d\conda.fish
no change     C:\ProgramData\mambaforge\shell\condabin\Conda.psm1
no change     C:\ProgramData\mambaforge\shell\condabin\conda-hook.ps1
no change     C:\ProgramData\mambaforge\Lib\site-packages\xontrib\conda.xsh
no change     C:\ProgramData\mambaforge\etc\profile.d\conda.csh
no change     C:\Users\Lenovo\Documents\WindowsPowerShell\profile.ps1
no change     HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
No action taken.

### environment.yml

```yaml
[Applicable to any enviroment which was created with mamba]

~/.condarc

channels:
  - defaults
  - conda-forge
jonashaag commented 1 year ago

Maybe something is wrong with the detection of Git bash. You can explicitly make init set up for bash by passing the --shell option.

GrigoriiTarasov commented 1 year ago

Sorry, I tried mamba init --shell

usage: mamba [-h] [-V] command ...
mamba: error: unrecognized arguments: --shell

mamba --shell

usage: mamba [-h] [-V] command ...
mamba: error: the following arguments are required: command

in git bash, what is the correct way to write it and where?

cosing commented 4 months ago

@GrigoriiTarasov

add \. "$_CONDA_ROOT/etc/profile.d/mamba.sh" || return $? to your activate file like this(no + ,i just use diff -u to show the style

 # Copyright (C) 2012 Anaconda, Inc
 # SPDX-License-Identifier: BSD-3-Clause
 \. "$_CONDA_ROOT/etc/profile.d/conda.sh" || return $?
+\. "$_CONDA_ROOT/etc/profile.d/mamba.sh" || return $?
 conda activate "$@"

I found this problem a long time ago, and at that time I solved it by a method I didn't understand myself. But when the file was overwritten and then invalidated during a version update, I had to change the file again.

I'm surprised that people haven't really been paying attention to this problem. Maybe people prefer to use powershell on Windows? I suggest you add the word bash to the title of the issue to make it easier for people to find this place when they have problems. Or can someone explain why and then merge it into the mainline branch to fix the problem (?)