mamba: ImportError: cannot import name 'init_std_stream_encoding' from 'conda.common.compat'
My mamba install was working fine till now when I suddenly get this today on any mamba command.
❯ mamba
Traceback (most recent call last):
File "/home/user/miniconda3/bin/mamba", line 11, in <module>
sys.exit(main())
File "/home/user/miniconda3/lib/python3.9/site-packages/mamba/mamba.py", line 892, in main
from conda.common.compat import ensure_text_type, init_std_stream_encoding
ImportError: cannot import name 'init_std_stream_encoding' from 'conda.common.compat' (/home/user/miniconda3/lib/python3.9/site-packages/conda/common/compat.py)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 31
- Comments: 29 (5 by maintainers)
Commits related to this issue
- MINOR: [CI] Fix mamba on AppVeyor Due to https://github.com/mamba-org/mamba/issues/1706, we must make sure we upgrade to the latest mamba version on AppVeyor. — committed to pitrou/arrow by pitrou 2 years ago
- MINOR: [CI] Fix mamba on AppVeyor Due to https://github.com/mamba-org/mamba/issues/1706, we must make sure we upgrade to the latest mamba version on AppVeyor. Closes #13263 from pitrou/minor-appveyo... — committed to apache/arrow by pitrou 2 years ago
- Update README.md Working on fixing conda version bug (https://github.com/mamba-org/mamba/issues/1706) — committed to Hollenbach-lab/PING by wesleymarin 2 years ago
I am also experiencing this issue. I keep my base environment stock (i.e., I don’t have any packages installed beyond what mambaforge comes with). I ran
mamba update --alltoday and mamba is completely broken.Edit:
For anyone stumbling upon this issue looking for a quick fix like I did, running
conda install conda=4.12in your base environment should do the trick for the time being.fixed it for me.
This worked for me only after
conda remove mamba. Then, when I tried to reinstall mamba (conda install mamba -c conda-forge), I saw conda pulling in 4.13.0 again 😕The trick then was
conda install mamba conda=4.12.0 -c conda-forge.I had this problem, too, so I updated mamba using conda:
Now, mamba no longer gives the “cannot import name ‘init_std_stream_encoding’” error, but it fails silently when running anything other than “mamba --version”.
If it matters, we’re running SMP Debian 5.10.113-1 (2022-04-29) x86_64 GNU/Linux
@Syzygianinfern0 you have the same old version of mamba, and the most recent conda version which breaks most mamba versions.
The previous conda and all mamba versions work fine. (conda 4.12 + mamba 0.23.3 for example).
I have added this repodata patch: https://github.com/conda-forge/conda-forge-repodata-patches-feedstock/pull/274 That should prevent this installation.
@maximlt if you start off from
MiniforgeorMambaforgeit would be more clean. We (conda-forge) cannot guarantee that mixing packages with defaults works.I can confirm this exact thing after I ran
conda update mamba -c conda-forge. @wolfv