Skip to content

miniforge does not update prompt with active environment when using cmd.exe #2533

@mmichal3

Description

@mmichal3

Conda-forge documentation

  • I could not solve my problem using the conda-forge documentation.

Installed packages

(base)PS C:\Users\mmichalski> conda list
# packages in environment at C:\Users\mmichalski\AppData\Local\miniforge3:
#
# Name                    Version                   Build  Channel
archspec                  0.2.5              pyhd8ed1ab_0    conda-forge
boltons                   24.0.0             pyhd8ed1ab_1    conda-forge
brotli-python             1.1.0           py312h275cf98_2    conda-forge
bzip2                     1.0.8                h2466b09_7    conda-forge
ca-certificates           2025.4.26            h4c7d964_0    conda-forge
certifi                   2025.4.26          pyhd8ed1ab_0    conda-forge
cffi                      1.17.1          py312h4389bb4_0    conda-forge
charset-normalizer        3.4.2              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_1    conda-forge
conda                     25.3.0          py312h2e8e312_0    conda-forge
conda-libmamba-solver     25.3.0             pyhd8ed1ab_0    conda-forge
conda-package-handling    2.4.0              pyh7900ff3_2    conda-forge
conda-package-streaming   0.11.0             pyhd8ed1ab_1    conda-forge
cpp-expected              1.1.0                hc790b64_1    conda-forge
distro                    1.9.0              pyhd8ed1ab_1    conda-forge
fmt                       11.1.4               h5f12afc_1    conda-forge
frozendict                2.4.6           py312h4389bb4_0    conda-forge
h2                        4.2.0              pyhd8ed1ab_0    conda-forge
hpack                     4.1.0              pyhd8ed1ab_0    conda-forge
hyperframe                6.1.0              pyhd8ed1ab_0    conda-forge
idna                      3.10               pyhd8ed1ab_1    conda-forge
jsonpatch                 1.33               pyhd8ed1ab_1    conda-forge
jsonpointer               3.0.0           py312h2e8e312_1    conda-forge
krb5                      1.21.3               hdf4eb48_0    conda-forge
libarchive                3.7.7                h5343c79_4    conda-forge
libcurl                   8.13.0               h88aaa65_0    conda-forge
libexpat                  2.7.0                he0c23c2_0    conda-forge
libffi                    3.4.6                h537db12_1    conda-forge
libiconv                  1.18                 h135ad9c_1    conda-forge
liblzma                   5.8.1                h2466b09_1    conda-forge
libmamba                  2.1.1                h00a3e12_0    conda-forge
libmambapy                2.1.1           py312h259b449_0    conda-forge
libsolv                   0.7.32               hbb528cf_2    conda-forge
libsqlite                 3.49.2               h67fdade_0    conda-forge
libssh2                   1.11.1               h9aa295b_0    conda-forge
libxml2                   2.13.8               h442d1da_0    conda-forge
libzlib                   1.3.1                h2466b09_2    conda-forge
lz4-c                     1.10.0               h2466b09_1    conda-forge
lzo                       2.10              hcfcfb64_1001    conda-forge
mamba                     2.1.1                hbfb34a1_0    conda-forge
menuinst                  2.2.0           py312h275cf98_0    conda-forge
miniforge_console_shortcut 1.0                  h57928b3_0    conda-forge
nlohmann_json             3.11.3               he0c23c2_1    conda-forge
openssl                   3.5.0                ha4e3fda_1    conda-forge
packaging                 25.0               pyh29332c3_1    conda-forge
pip                       25.1.1             pyh8b19718_0    conda-forge
platformdirs              4.3.8              pyhe01879c_0    conda-forge
pluggy                    1.5.0              pyhd8ed1ab_1    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.6           py312h4389bb4_2    conda-forge
pycparser                 2.22               pyh29332c3_1    conda-forge
pysocks                   1.7.1              pyh09c184e_7    conda-forge
python                    3.12.10         h3f84c4b_0_cpython    conda-forge
python_abi                3.12                    7_cp312    conda-forge
reproc                    14.2.5.post0         h2466b09_0    conda-forge
reproc-cpp                14.2.5.post0         he0c23c2_0    conda-forge
requests                  2.32.3             pyhd8ed1ab_1    conda-forge
ruamel.yaml               0.18.10         py312h4389bb4_0    conda-forge
ruamel.yaml.clib          0.2.8           py312h4389bb4_1    conda-forge
setuptools                80.1.0             pyhff2d567_0    conda-forge
simdjson                  3.12.3               hc790b64_0    conda-forge
tk                        8.6.13               h5226925_1    conda-forge
tqdm                      4.67.1             pyhd8ed1ab_1    conda-forge
truststore                0.10.1             pyh29332c3_0    conda-forge
tzdata                    2025b                h78e105d_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_1    conda-forge
urllib3                   2.4.0              pyhd8ed1ab_0    conda-forge
vc                        14.3                h2b53caa_26    conda-forge
vc14_runtime              14.42.34438         hfd919c2_26    conda-forge
wheel                     0.45.1             pyhd8ed1ab_1    conda-forge
win_inet_pton             1.1.0              pyh7428d3b_8    conda-forge
yaml-cpp                  0.8.0                he0c23c2_0    conda-forge
zstandard                 0.23.0          py312h4389bb4_2    conda-forge
zstd                      1.5.7                hbeecb71_2    conda-forge
(base)PS C:\Users\mmichalski>

Environment info

active environment : base
    active env location : C:\Users\mmichalski\AppData\Local\miniforge3
            shell level : 1
       user config file : C:\Users\mmichalski\.condarc
 populated config files : C:\Users\mmichalski\AppData\Local\miniforge3\.condarc
                          C:\Users\mmichalski\.condarc
          conda version : 25.3.0
    conda-build version : not installed
         python version : 3.12.10.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=skylake
                          __conda=25.3.0=0
                          __win=10.0.22631=0
       base environment : C:\Users\mmichalski\AppData\Local\miniforge3  (writable)
      conda av data dir : C:\Users\mmichalski\AppData\Local\miniforge3\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : C:\Users\mmichalski\AppData\Local\miniforge3\pkgs
                          C:\Users\mmichalski\.conda\pkgs
                          C:\Users\mmichalski\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\mmichalski\AppData\Local\miniforge3\envs
                          C:\Users\mmichalski\.conda\envs
                          C:\Users\mmichalski\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/25.3.0 requests/2.32.3 CPython/3.12.10 Windows/11 Windows/10.0.22631 solver/libmamba conda-libmamba-solver/25.3.0 libmambapy/2.1.1
          administrator : False
             netrc file : None
           offline mode : False

Issue

I installed miniconda. I then ran:
conda create -c conda-forge -n spyder-env spyder numpy scipy pandas matplotlib sympy cython

the prompt simply read C:\Users\Username\ and did not show the active environment (base)
I then ran:
conda activate spyder-env
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict

The prompt still did not show the active environment.(which should then have been "spyder-env"

I closed and reopened the prompt using the shortcut that was created during the miniforge install with no effect.

I then opened PowerShell. The prompt correctly displayed the active environment (base) and when I ran "conda activate base" and "conda activate spyder-env" it correctly changed.

I then opened cmd.exe from the link that was created during the miniforge install and it still did not show the active environment. I typed powershell. The prompt displayed correctly. I exited powershell and closed the cmd.exe window.

I then launched cmd.exe again. I ran "mamba activate base" and it correctly displayed the active environment in the prompt. I ran "mamba activate spyder-env" and it correctly changed to display active environment. I tried it in powershell and mamba worked correctly.

Still in powershell I then ran "conda activate base". It correctly displayed "base" in the prompt. I then exited powershell to cmd.exe. It incorrectly showed "spyder-env", the last thing mamba changed it to.

I think what is going on here is that mamba appears to set the prompt from "C:\Users\mmichalski\AppData\Local\miniforge3\condabin_mamba_activate.bat. I cant find an analagous command in any of the conda batch files.

On the other hand, "C:\Users\mmichalski\AppData\Local\miniforge3\shell\condabin" contains powershell scripts (conda.psm1) which contain a command to change the powershell prompt. This apperantly makes it work in powershell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions