conda-forge / miniforge

A conda-forge distribution.
https://conda-forge.org/miniforge
Other
6.57k stars 332 forks source link

`mamba activate/deactivate` not work in PowerShell #619

Open sun2ot opened 3 months ago

sun2ot commented 3 months ago

Solution to issue cannot be found in the documentation.

Issue

After installed the latest miniforge, running mamba init powershell, but the mamba activate/deactivate is not working. It will not change the env and output no errors. And conda activate/deactivate is working properly.

Installed packages

# packages in environment at F:\env\miniforge3:
#
# Name                    Version                   Build  Channel
archspec                  0.2.3              pyhd8ed1ab_0    conda-forge
boltons                   24.0.0             pyhd8ed1ab_0    conda-forge
brotli-python             1.1.0           py310h00ffb61_1    conda-forge
bzip2                     1.0.8                hcfcfb64_5    conda-forge
ca-certificates           2024.2.2             h56e8100_0    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py310h8d17308_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     24.3.0          py310h5588dad_0    conda-forge
conda-libmamba-solver     24.1.0             pyhd8ed1ab_0    conda-forge
conda-package-handling    2.2.0              pyh38be061_0    conda-forge
conda-package-streaming   0.9.0              pyhd8ed1ab_0    conda-forge
distro                    1.9.0              pyhd8ed1ab_0    conda-forge
fmt                       10.2.1               h181d51b_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
jsonpatch                 1.33               pyhd8ed1ab_0    conda-forge
jsonpointer               2.4             py310h5588dad_3    conda-forge
krb5                      1.21.2               heb0366b_0    conda-forge
libarchive                3.7.2                h313118b_1    conda-forge
libcurl                   8.7.1                hd5e4a3a_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libiconv                  1.17                 hcfcfb64_2    conda-forge
libmamba                  1.5.8                h3f09ed1_0    conda-forge
libmambapy                1.5.8           py310h04f2035_0    conda-forge
libsolv                   0.7.28               h12be248_2    conda-forge
libsqlite                 3.45.2               hcfcfb64_0    conda-forge
libssh2                   1.11.0               h7dfc565_0    conda-forge
libxml2                   2.12.6               hc3477c8_1    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
lz4-c                     1.9.4                hcfcfb64_0    conda-forge
lzo                       2.10              he774522_1000    conda-forge
mamba                     1.5.8           py310hd9d798f_0    conda-forge
menuinst                  2.0.2           py310h00ffb61_0    conda-forge
miniforge_console_shortcut 1.0                  h57928b3_0    conda-forge
openssl                   3.2.1                hcfcfb64_1    conda-forge
packaging                 24.0               pyhd8ed1ab_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
platformdirs              4.2.0              pyhd8ed1ab_0    conda-forge
pluggy                    1.4.0              pyhd8ed1ab_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.6           py310h8d17308_0    conda-forge
pycparser                 2.22               pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.10.14         h4de0772_0_cpython    conda-forge
python_abi                3.10                    4_cp310    conda-forge
reproc                    14.2.4.post0         hcfcfb64_1    conda-forge
reproc-cpp                14.2.4.post0         h63175ca_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.18.6          py310h8d17308_0    conda-forge
ruamel.yaml.clib          0.2.8           py310h8d17308_0    conda-forge
setuptools                69.5.1             pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5226925_1    conda-forge
tqdm                      4.66.2             pyhd8ed1ab_0    conda-forge
truststore                0.8.0              pyhd8ed1ab_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
urllib3                   2.2.1              pyhd8ed1ab_0    conda-forge
vc                        14.3                hcf57466_18    conda-forge
vc14_runtime              14.38.33130         h82b7239_18    conda-forge
vs2015_runtime            14.38.33130         hcb4865c_18    conda-forge
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
xz                        5.2.6                h8d14728_0    conda-forge
yaml-cpp                  0.8.0                h63175ca_0    conda-forge
zstandard                 0.22.0          py310h0009e47_0    conda-forge
zstd                      1.5.5                h12be248_0    conda-forge

Environment info

active environment : base
    active env location : F:\env\miniforge3
            shell level : 1
       user config file : C:\Users\yzh\.condarc
 populated config files : F:\env\miniforge3\.condarc
                          C:\Users\yzh\.condarc
          conda version : 24.3.0
    conda-build version : not installed
         python version : 3.10.14.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=x86_64_v4
                          __conda=24.3.0=0
                          __cuda=12.4=0
                          __win=0=0
       base environment : F:\env\miniforge3  (writable)
      conda av data dir : F:\env\miniforge3\etc\conda
  conda av metadata url : None
           channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch
          package cache : F:\env\miniforge3\pkgs
                          C:\Users\yzh\.conda\pkgs
                          C:\Users\yzh\AppData\Local\conda\conda\pkgs
       envs directories : F:\env\miniforge3\envs
                          C:\Users\yzh\.conda\envs
                          C:\Users\yzh\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/24.3.0 requests/2.31.0 CPython/3.10.14 Windows/10 Windows/10.0.22631 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.8
          administrator : False
             netrc file : None
           offline mode : False
mousey92 commented 3 months ago

I have the same issue, and it does work in Windows Subsystem for Linux.

in Powershell:

> cd C:\
(base) PS C:\> where.exe python.exe
C:\Users\Matthijs.Kramer\AppData\Local\miniforge3\python.exe
C:\Users\Matthijs.Kramer\AppData\Local\Microsoft\WindowsApps\python.exe
(base) PS C:\> mamba activate test
(base) PS C:\> where.exe python.exe
C:\Users\Matthijs.Kramer\AppData\Local\miniforge3\python.exe
C:\Users\Matthijs.Kramer\AppData\Local\Microsoft\WindowsApps\python.exe
(base) PS C:\> conda activate test
(test) PS C:\> where.exe python.exe
C:\Users\Matthijs.Kramer\AppData\Local\miniforge3\envs\test\python.exe
C:\Users\Matthijs.Kramer\AppData\Local\miniforge3\python.exe
C:\Users\Matthijs.Kramer\AppData\Local\Microsoft\WindowsApps\python.exe

In WSL (Ubuntu terminal):

(manta) matthijs@DTN-FXC2PX3:/$ mamba deactivate
(base) matthijs@DTN-FXC2PX3:/$ which python
/home/matthijs/miniforge3/bin/python
(base) matthijs@DTN-FXC2PX3:/$ cd /
(base) matthijs@DTN-FXC2PX3:/$ which python
/home/matthijs/miniforge3/bin/python
(base) matthijs@DTN-FXC2PX3:/$ mamba activate test
(test) matthijs@DTN-FXC2PX3:/$ which python
/home/matthijs/miniforge3/envs/test/bin/python
Morimiue commented 2 months ago

I have the same issue. mamba activate/deactivate works in cmd but not in PowerShell.

rubenmejiac commented 1 month ago

I have the same issue using Windows Powershell and Powershell 7. Using command prompt, using the Miniforge3 prompt shortcut, everything works as expected.

jakirkham commented 1 month ago

Adding "help wanted" as this will need code contributions from someone familiar with and the ability to test Windows and PowerShell to improve