Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micromamba parses condarc YAML with <CR> line breaks incorrectly #3401

Open
3 tasks done
HedgehogCode opened this issue Aug 9, 2024 · 1 comment
Open
3 tasks done

Comments

@HedgehogCode
Copy link

HedgehogCode commented Aug 9, 2024

Troubleshooting docs

  • My problem is not solved in the Troubleshooting docs

Anaconda default channels

  • I do NOT use the Anaconda default channels (pkgs/* etc.)

How did you install Mamba?

Micromamba

Search tried in issue tracker

yes

Latest version of Mamba

  • My problem is not solved with the latest version

Tried in Conda?

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

Describe your issue

If the .condarc file uses only the <CR> character as line breaks (without a following <LF>) the settings are not correctly parsed causing errors.

Try the following Python script for creating such a .condarc file:

yaml_content = (
    "default_channels:\r"
    "- https://foo.bar/my-channel\r"
    "- https://foo.bar/my-second-channel\r"
)
with open("condarc_with_CR.yaml", "w", newline="") as file:
    file.write(yaml_content)

# NB: Loading this with PyYAML works fine
from yaml import load, Loader, CLoader
print("Loader:", load(yaml_content, Loader))
print("CLoader:", load(yaml_content, CLoader))

Using the output of this file as the .condarc causes the following error:

% ./micromamba create -p ./foo -c conda-forge python
critical libmamba Failed to parse URL "https://foo.bar/my-channel - https://foo.bar/my-second-channel": Malformed input to a URL function

Note, that the YAML Specification allows using only <CR> for line endings and conda handles them correctly. This might be related to jbeder/yaml-cpp#986.

mamba info / micromamba info

% micromamba info # executed without the critical `.condarc` file to get an output
       libmamba version : 2.0.0
 micromamba-2rc version : 2.0.0
           curl version : libcurl/8.9.1 OpenSSL/3.3.1 zlib/1.3.1 zstd/1.5.6 libssh2/1.11.0 nghttp2/1.58.0
     libarchive version : libarchive 3.7.4 zlib/1.2.13 bz2lib/1.0.8 libzstd/1.5.6
       envs directories : /home/benjamin/.local/share/mamba/envs
          package cache : /home/benjamin/.local/share/mamba/pkgs
                          /home/benjamin/.mamba/pkgs
            environment : /home/benjamin/miniconda3 (active)
           env location : /home/benjamin/miniconda3
      user config files : /home/benjamin/.mambarc
 populated config files : /home/benjamin/.condarc
       virtual packages : __unix=0=0
                          __linux=6.5.0=0
                          __glibc=2.35=0
                          __archspec=1=x86_64-v3
               channels : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
       base environment : /home/benjamin/.local/share/mamba
               platform : linux-64

Logs

% ./micromamba create -v -p ./foo -c conda-forge python
critical libmamba Failed to parse URL "https://foo.bar/my-channel - https://foo.bar/my-second-channel": Malformed input to a URL function

environment.yml

No response

~/.condarc

Note that this does not reflect the line endings of the real file. See the ticket description.

default_channels:
- https://foo.bar/my-channel
- https://foo.bar/my-second-channel
@Hind-M
Copy link
Member

Hind-M commented Aug 14, 2024

cf. jbeder/yaml-cpp#1309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants