conda-forge / miniforge

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

cannot import name 'ensure_name_or_prefix' from 'conda.cli.common' #499

Closed otavio-silva closed 7 months ago

otavio-silva commented 9 months ago

Solution to issue cannot be found in the documentation.

Issue

Trying to run any mamba command gives the following error in any enviroment:

Traceback (most recent call last):
  File "C:\Users\otavi\scoop\apps\mambaforge\current\Scripts\mamba-script.py", line 6, in <module>
    from mamba.mamba import main
  File "C:\Users\otavi\scoop\apps\mambaforge\current\lib\site-packages\mamba\mamba.py", line 16, in <module>
    from conda.cli.common import (
ImportError: cannot import name 'ensure_name_or_prefix' from 'conda.cli.common' (C:\Users\otavi\scoop\apps\mambaforge\current\lib\site-packages\conda\cli\common.py)

Installed packages

# packages in environment at C:\Users\otavi\scoop\apps\mambaforge\current:
#
# Name                    Version                   Build  Channel
boltons                   23.0.0             pyhd8ed1ab_0    conda-forge
brotli-python             1.1.0           py310h00ffb61_1    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2023.7.22            h56e8100_0    conda-forge
certifi                   2023.7.22          pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py310h8d17308_0    conda-forge
charset-normalizer        3.2.0              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     23.9.0          py310h5588dad_0    conda-forge
conda-libmamba-solver     23.9.1             pyhd8ed1ab_0    conda-forge
conda-package-handling    2.2.0              pyh38be061_0    conda-forge
conda-package-streaming   0.9.0              pyhd8ed1ab_0    conda-forge
cryptography              41.0.4          py310h6e82f81_0    conda-forge
fmt                       10.1.1               h181d51b_0    conda-forge
idna                      3.4                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.6.2                h6f8411a_1    conda-forge
libcurl                   8.3.0                hd5e4a3a_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libiconv                  1.17                 h8ffe710_0    conda-forge
libmamba                  1.5.1                h16d0179_0    conda-forge
libmambapy                1.5.1           py310h04f2035_0    conda-forge
libsolv                   0.7.25               h12be248_0    conda-forge
libsqlite                 3.43.0               hcfcfb64_0    conda-forge
libssh2                   1.11.0               h7dfc565_0    conda-forge
libxml2                   2.11.5               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.1           py310hd9d798f_0    conda-forge
menuinst                  1.4.19          py310h5588dad_1    conda-forge
miniforge_console_shortcut 2.0                  h57928b3_1    conda-forge
openssl                   3.1.3                hcfcfb64_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pip                       23.2.1             pyhd8ed1ab_0    conda-forge
pluggy                    1.3.0              pyhd8ed1ab_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.4           py310h8d17308_2    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyopenssl                 23.2.0             pyhd8ed1ab_1    conda-forge
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.10.12         h4de0772_0_cpython    conda-forge
python_abi                3.10                    4_cp310    conda-forge
reproc                    14.2.4.post0         hcfcfb64_0    conda-forge
reproc-cpp                14.2.4.post0         h63175ca_0    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.17.33         py310h8d17308_1    conda-forge
ruamel.yaml.clib          0.2.7           py310h8d17308_2    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
tk                        8.6.13               hcfcfb64_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tqdm                      4.66.1             pyhd8ed1ab_0    conda-forge
truststore                0.8.0              pyhd8ed1ab_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
urllib3                   2.0.5              pyhd8ed1ab_0    conda-forge
vc                        14.3                h64f974e_17    conda-forge
vc14_runtime              14.36.32532         hfdfe4a8_17    conda-forge
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
wheel                     0.41.2             pyhd8ed1ab_0    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
xz                        5.2.6                h8d14728_0    conda-forge
yaml-cpp                  0.7.0                h63175ca_3    conda-forge
zstandard                 0.21.0          py310h0009e47_1    conda-forge
zstd                      1.5.5                h12be248_0    conda-forge

Environment info

active environment : base
    active env location : C:\Users\otavi\scoop\apps\mambaforge\current
            shell level : 1
       user config file : C:\Users\otavi\.condarc
 populated config files : C:\Users\otavi\scoop\apps\mambaforge\23.3.1-1\.condarc
                          C:\Users\otavi\.condarc
          conda version : 23.9.0
    conda-build version : not installed
         python version : 3.10.12.final.0
       virtual packages : __archspec=1=x86_64
                          __cuda=12.2=0
                          __win=0=0
       base environment : C:\Users\otavi\scoop\apps\mambaforge\current  (writable)
      conda av data dir : C:\Users\otavi\scoop\apps\mambaforge\current\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\otavi\scoop\apps\mambaforge\current\pkgs
                          C:\Users\otavi\.conda\pkgs
                          C:\Users\otavi\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\otavi\scoop\apps\mambaforge\current\envs
                          C:\Users\otavi\.conda\envs
                          C:\Users\otavi\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/23.9.0 requests/2.31.0 CPython/3.10.12 Windows/10 Windows/10.0.22621
          administrator : False
             netrc file : None
           offline mode : False
fcr commented 9 months ago

I have exactly the same problem on macOS Ventura 13.6

WhoisDonlee commented 9 months ago

Looks like ensure_name_or_prefix was deprecated in the latest conda release 23.9.0 https://github.com/conda/conda/issues/12385

jaimergp commented 9 months ago

Fixed in mamba. Pending release.

manueldeljesus commented 9 months ago

Any idea of when will it be released and how to get it installed once it's released? It seems that my system is now in a completely unstable state, since conda does not seem to be able to solve any environment, so I would say updating mamba through conda won't even be an option.

jaimergp commented 9 months ago

See https://github.com/mamba-org/mamba/issues/2882#issuecomment-1746314832

jaimergp commented 9 months ago

1.5.2 should be out with a fix now

kupiqu commented 8 months ago

1.5.2 should be out with a fix now

Where can I find it?

jaimergp commented 8 months ago

In the conda-forge channel, mamba 1.5.2

qq-me commented 8 months ago

In the conda-forge channel, mamba 1.5.2

how do I update to mamba 1.5.2? I found mamba update -n base mamba on google but it says ImportError: cannot import name 'ensure_name_or_prefix' from 'conda.cli.common' (D:\Mambaforge\lib\site-packages\conda\cli\common.py)

hmaarrfk commented 8 months ago

Unfortunately you have to download the package manually or using conda.

Download the appropriate 1.5.2 manually from: https://anaconda.org/conda-forge/mamba/files

Search for

win-64/mamba-1.5.2-py

and ensure that the version of python that works for you follows.

conda install C:\User\YOUR_USER\Downloads\mamba-1.5.2-py......

and then mamba should work.

hmaarrfk commented 8 months ago

I'm tempted to close this issue. It is unfortunate, but it is difficult for us to recover from these.

xylar commented 8 months ago

In case it helps anyone else, I found I couldn't get unstuck until I uninstalled boa and conda-build. They were preventing an update to a newer mamba.

hmaarrfk commented 7 months ago

I got hit by this again. However, I don't think we have a real solution for this. Unfortunate, but I had to reinstall my system.