mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.53k stars 342 forks source link

mamba create -f "could not parse" from yaml spec file #3327

Closed cefect closed 2 weeks ago

cefect commented 2 weeks ago

Troubleshooting docs

Anaconda default channels

How did you install Mamba?

Mambaforge or latest Miniforge

Search tried in issue tracker

yes

Latest version of Mamba

Tried in Conda?

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

Describe your issue

unable to parse a yaml spec file:

mamba create -n testenv --file ./test.yml

>>>could not parse 'name: testenv' in: ./test.yml

Works fine in conda. tried re-installing conda/mamba from miniforge, tried updating, different yaml files, different line endings, re-creating the yaml file... no luck. However, I'm new to mamba so I suspect there is something obvious I'm missing.

mamba info / micromamba info

mamba version : 1.5.8
     active environment : base
    active env location : C:\Users\cef\miniforge3
            shell level : 1
       user config file : C:\Users\cef\.condarc
 populated config files : C:\Users\cef\miniforge3\.condarc
                          C:\Users\cef\.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=skylake
                          __conda=24.3.0=0
                          __cuda=12.2=0
                          __win=0=0
       base environment : C:\Users\cef\miniforge3  (writable)
      conda av data dir : C:\Users\cef\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\cef\miniforge3\pkgs
                          C:\Users\cef\.conda\pkgs
                          C:\Users\cef\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\cef\miniforge3\envs
                          C:\Users\cef\.conda\envs
                          C:\Users\cef\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.19045 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.8
          administrator : False
             netrc file : None
           offline mode : False

Logs

No response

environment.yml

name: testenv
channels:
  - conda-forge
dependencies:
  - python >=3.6,<3.7
  - ipykernel >=5.1
  - ipywidgets

~/.condarc

No response

Hind-M commented 2 weeks ago

What if you remove name: testenv from the environment.yml or keep it and use mamba create --file ./test.yml instead?

cefect commented 2 weeks ago

mamba create --file ./test.yml gives the following error: mamba create: error: one of the arguments -n/--name -p/--prefix is required

removing the names field just pushes the parse error down to the channels field. I've tried lots tweaking spacing and line endings, also with no effect.

Thank you for your insights and ideas

Hind-M commented 2 weeks ago

Is this error >>>could not parse 'name: testenv' in: ./test.yml coming from Conda? Can you try with mamba env create -n testenv --file ./test.yml?

cefect commented 2 weeks ago

The error is the result of my mamba call, but difficult for me to tell what is causing it:

mamba create -n testenv --file ./test.yml

could not parse '- conda-forge' in: ./test.yml

CondaValueError: could not parse '- conda-forge' in: ./test.yml

Your suggestion (mamba env create) works. Does this still use mamba's backends? I can't tell from my test case if its any faster. Am I misunderstanding the documentation?

mamba create -h

  --file FILE           Read package versions from the given file. Repeated file specifications can be passed (e.g.
                        --file=file1 --file=file2).
Hind-M commented 2 weeks ago

CondaValueError: So yes the error is coming from conda. Mamba 1.x (your version is 1.5.8) is using conda behind the scenes, but micromamba on the other hand, is completely independent from it and is a single executable cf. https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html. There is mamba 2.0 coming up soon, which is completely independent from conda as well. And there, mamba and micromamba would have the same backends but only linked differently (dynamically for mamba and statistically for micromamba). There is a beta3 for mamba/micromamba 2.0 available on conda-forge if you would like to try it out!

Hind-M commented 2 weeks ago

As for the documentation, I agree that's unclear (mamba is using conda's doc as well) and it can be confusing as mamba/conda create -h is suggesting to use the --file flag but is actually using it in the given examples in env create -h. I would suggest that everything related to environment management would be env subcommand instead of command.

cefect commented 2 weeks ago

Thank you for the fast and detailed response. Looking forward to 2.0!