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

InavlidMatchSpec error installing from libmamba solver installing into environment with package installed from a file #418

Closed
2 tasks done
analog-cbarber opened this issue Jan 6, 2024 · 6 comments · Fixed by #421
Labels
source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type

Comments

@analog-cbarber
Copy link

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

I created a simple test environment and installed a package directly from a downloaded conda file. That works, but then attempts to install other packages from a channel results in an InvalidMatchSpec error from the libmamba solver. For instance, having downloaded the tomlkit conda package (which you can take from your pkgs folder if previously installed)

$ conda create -n foobar python=3.10
$ conda install -n foobar ~/miniconda3/pkgs/tomlkit-0.12.3-py_0.conda 
$ conda install -n foobar pytest
Channels:
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: failed

InvalidMatchSpec: Invalid spec 'tomlkit[url=file:///Users/Christopher.Barber/miniconda3/pkgs/tomlkit-0.12.3-py_0.conda]': Libmamba only supports a subset of the MatchSpec interface for now. You can only use ('name', 'version', 'build', 'channel', 'subdir'), but you tried to use ('url',).

If you do the last install using the classic solver then it still works:

t$ conda install -n foobar --solver classic --yes pytest
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/Christopher.Barber/miniconda3/envs/foobar

  added / updated specs:
    - pytest


The following NEW packages will be INSTALLED:

  colorama           conda-forge/noarch::colorama-0.4.6-pyhd8ed1ab_0 
  exceptiongroup     conda-forge/noarch::exceptiongroup-1.2.0-pyhd8ed1ab_0 
  iniconfig          conda-forge/noarch::iniconfig-2.0.0-pyhd8ed1ab_0 
  packaging          conda-forge/noarch::packaging-23.2-pyhd8ed1ab_0 
  pluggy             conda-forge/noarch::pluggy-1.3.0-pyhd8ed1ab_0 
  pytest             conda-forge/noarch::pytest-7.4.4-pyhd8ed1ab_0 
  tomli              conda-forge/noarch::tomli-2.0.1-pyhd8ed1ab_0 



Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Obviously, this is not a normal way to install packages, but it would still be nice if this could work for those of us trying to create our own build/test tools.

Conda Info

active environment : base
    active env location : /Users/Christopher.Barber/miniconda3
            shell level : 1
       user config file : /Users/Christopher.Barber/.condarc
 populated config files : /Users/Christopher.Barber/.condarc
          conda version : 23.11.0
    conda-build version : 3.27.0
         python version : 3.11.5.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=m1
                          __conda=23.11.0=0
                          __osx=13.5.2=0
                          __unix=0=0
       base environment : /Users/Christopher.Barber/miniconda3  (writable)
      conda av data dir : /Users/Christopher.Barber/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/Christopher.Barber/miniconda3/pkgs
                          /Users/Christopher.Barber/.conda/pkgs
       envs directories : /Users/Christopher.Barber/miniconda3/envs
                          /Users/Christopher.Barber/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.11.0 requests/2.31.0 CPython/3.11.5 Darwin/22.6.0 OSX/13.5.2 solver/libmamba conda-libmamba-solver/23.12.0 libmambapy/1.5.5
                UID:GID : 502:20
             netrc file : None
           offline mode : False

Conda Config

==> /Users/Christopher.Barber/.condarc <==
auto_stack: 1
pip_interop_enabled: False
path_conflict: warn
ssl_verify: True
remote_max_retries: 10
channel_priority: flexible
channels:
  - conda-forge
default_channels:
  - conda-forge
repodata_fns:
  - repodata.json
report_errors: True
solver: libmamba

Conda list

# packages in environment at /Users/Christopher.Barber/miniconda3/envs/foobar:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h93a5062_5    defaults
ca-certificates           2023.11.17           hf0a4a13_0    defaults
colorama                  0.4.6              pyhd8ed1ab_0    defaults
exceptiongroup            1.2.0              pyhd8ed1ab_0    defaults
iniconfig                 2.0.0              pyhd8ed1ab_0    defaults
libffi                    3.4.2                h3422bc3_5    defaults
libsqlite                 3.44.2               h091b4b1_0    defaults
libzlib                   1.2.13               h53f4e23_5    defaults
ncurses                   6.4                  h463b476_2    defaults
openssl                   3.2.0                h0d3ecfb_1    defaults
packaging                 23.2               pyhd8ed1ab_0    defaults
pip                       23.3.2             pyhd8ed1ab_0    defaults
pluggy                    1.3.0              pyhd8ed1ab_0    defaults
pytest                    7.4.4              pyhd8ed1ab_0    defaults
python                    3.10.13         h2469fbe_1_cpython    defaults
readline                  8.2                  h92ec313_1    defaults
setuptools                69.0.3             pyhd8ed1ab_0    defaults
tk                        8.6.13               h5083fa2_1    defaults
tomli                     2.0.1              pyhd8ed1ab_0    defaults
tomlkit                   0.12.3                     py_0    <unknown>
tzdata                    2023d                h0c530f3_0    defaults
wheel                     0.42.0             pyhd8ed1ab_0    defaults
xz                        5.2.6                h57fd34a_0    defaults

Additional Context

Surprisingly, although libmamba does not work, mamba itself (version 1.5.5) works fine.

One workaround for such test environments is to set the solver to classic for the environment.

@analog-cbarber analog-cbarber added the type::bug describes erroneous operation, use severity::* to classify the type label Jan 6, 2024
@analog-cbarber
Copy link
Author

I upgraded my conda/mamba packages and now see an even worse failure behavior

$ conda install -n foobar pytest
Channels:
 - defaults
 - <unknown>
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 17, in __call__
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/cli/main.py", line 78, in main_subshell
        exit_code = do_call(args, parser)
                    ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/cli/conda_argparse.py", line 166, in do_call
        result = getattr(module, func_name)(args, parser)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/notices/core.py", line 124, in wrapper
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/cli/main_install.py", line 26, in execute
        install(args, parser, "install")
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/cli/install.py", line 320, in install
        unlink_link_transaction = solver.solve_for_transaction(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/core/solve.py", line 139, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(
                                   ^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/core/solve.py", line 200, in solve_for_diff
        final_precs = self.solve_final_state(
                      ^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda_libmamba_solver/solver.py", line 215, in solve_final_state
        out_state = self._solving_loop(in_state, out_state, index)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda_libmamba_solver/solver.py", line 267, in _solving_loop
        solved = self._solve_attempt(in_state, out_state, index)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda_libmamba_solver/solver.py", line 367, in _solve_attempt
        self.solver.add_jobs(specs, task_type)
    RuntimeError: The package "<unknown>/noarch::tomlkit==0.12.3=py_0" is not available for the specified platform

`$ /Users/Christopher.Barber/miniconda3/bin/conda install -n foobar pytest`

  environment variables:
                   CDPATH=.:..:/Users/Christopher.Barber:/Users/Christopher.Barber/ws
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=/Users/Christopher.Barber/miniconda3/bin/conda
             CONDA_PREFIX=/Users/Christopher.Barber/miniconda3
       CONDA_PROJECT_ROOT=/Users/cbarber/ws/conda
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=/Users/Christopher.Barber/miniconda3/bin/python
               CONDA_ROOT=/Users/Christopher.Barber/miniconda3
              CONDA_SHLVL=1
           CURL_CA_BUNDLE=<not set>
     JAVA_LD_LIBRARY_PATH=/Users/Christopher.Barber/miniconda3/lib/jvm/lib/server
               LD_PRELOAD=<not set>
                     PATH=/Users/Christopher.Barber/miniconda3/bin:/Users/Christopher.Barber/min
                          iconda3/condabin:/Users/Christopher.Barber/bin:/usr/local/bin:/System/
                          Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/podman/bin:/v
                          ar/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bi
                          n:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:
                          /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/applei
                          nternal/bin:/Applications/kdiff3.app/Contents/MacOS
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : /Users/Christopher.Barber/miniconda3
            shell level : 1
       user config file : /Users/Christopher.Barber/.condarc
 populated config files : /Users/Christopher.Barber/.condarc
          conda version : 23.9.0
    conda-build version : 3.27.0
         python version : 3.11.5.final.0
       virtual packages : __archspec=1=m1
                          __osx=13.5.2=0
                          __unix=0=0
       base environment : /Users/Christopher.Barber/miniconda3  (writable)
      conda av data dir : /Users/Christopher.Barber/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/Christopher.Barber/miniconda3/pkgs
                          /Users/Christopher.Barber/.conda/pkgs
       envs directories : /Users/Christopher.Barber/miniconda3/envs
                          /Users/Christopher.Barber/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.9.0 requests/2.31.0 CPython/3.11.5 Darwin/22.6.0 OSX/13.5.2 solver/libmamba conda-libmamba-solver/23.7.0 libmambapy/1.5.3
                UID:GID : 502:20
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
If you suspect this error is being caused by a malfunctioning plugin,
consider using the --no-plugins option to turn off plugins.

Example: conda --no-plugins install <package>

Alternatively, you can set the CONDA_NO_PLUGINS environment variable on
the command line to run the command without plugins enabled.

Example: CONDA_NO_PLUGINS=true conda install <package>

Upload successful.

This is with


     active environment : base
    active env location : /Users/Christopher.Barber/miniconda3
            shell level : 1
       user config file : /Users/Christopher.Barber/.condarc
 populated config files : /Users/Christopher.Barber/.condarc
          conda version : 23.9.0
    conda-build version : 3.27.0
         python version : 3.11.5.final.0
       virtual packages : __archspec=1=m1
                          __osx=13.5.2=0
                          __unix=0=0
       base environment : /Users/Christopher.Barber/miniconda3  (writable)
      conda av data dir : /Users/Christopher.Barber/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/Christopher.Barber/miniconda3/pkgs
                          /Users/Christopher.Barber/.conda/pkgs
       envs directories : /Users/Christopher.Barber/miniconda3/envs
                          /Users/Christopher.Barber/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.9.0 requests/2.31.0 CPython/3.11.5 Darwin/22.6.0 OSX/13.5.2 solver/libmamba conda-libmamba-solver/23.7.0 libmambapy/1.5.3
                UID:GID : 502:20
             netrc file : None
           offline mode : False

@analog-cbarber
Copy link
Author

As before, the classic solver or mamba still work.

@travishathaway
Copy link
Contributor

travishathaway commented Jan 8, 2024

@jaimergp or @jezdez,

I believe this belongs in https://github.com/conda/conda-libmamba-solver. Could one of you please transfer it?

@jaimergp jaimergp transferred this issue from conda/conda Jan 8, 2024
@jaimergp
Copy link
Contributor

jaimergp commented Jan 8, 2024

Thanks for the report! Can you check if setting CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 for that command works?

@analog-cbarber
Copy link
Author

I assume that is an environment variable? Setting that has no effect:

(foobar) $ export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1
(foobar) $ conda install pytest
Channels:
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 17, in __call__
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/cli/main.py", line 78, in main_subshell
        exit_code = do_call(args, parser)
                    ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/cli/conda_argparse.py", line 166, in do_call
        result = getattr(module, func_name)(args, parser)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/notices/core.py", line 124, in wrapper
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/cli/main_install.py", line 26, in execute
        install(args, parser, "install")
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/cli/install.py", line 320, in install
        unlink_link_transaction = solver.solve_for_transaction(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/core/solve.py", line 139, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(
                                   ^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda/core/solve.py", line 200, in solve_for_diff
        final_precs = self.solve_final_state(
                      ^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda_libmamba_solver/solver.py", line 215, in solve_final_state
        out_state = self._solving_loop(in_state, out_state, index)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda_libmamba_solver/solver.py", line 267, in _solving_loop
        solved = self._solve_attempt(in_state, out_state, index)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/conda_libmamba_solver/solver.py", line 367, in _solve_attempt
        self.solver.add_jobs(specs, task_type)
    RuntimeError: The package "<unknown>/noarch::tomlkit==0.12.3=py_0" is not available for the specified platform

`$ /Users/Christopher.Barber/miniconda3/bin/conda install pytest`

  environment variables:
                   CDPATH=.:..:/Users/Christopher.Barber:/Users/Christopher.Barber/ws
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=foobar
                CONDA_EXE=/Users/Christopher.Barber/miniconda3/bin/conda
CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1
             CONDA_PREFIX=/Users/Christopher.Barber/miniconda3/envs/foobar
           CONDA_PREFIX_1=/Users/Christopher.Barber/miniconda3
           CONDA_PREFIX_2=/Users/Christopher.Barber/miniconda3/envs/eispydata
       CONDA_PROJECT_ROOT=/Users/cbarber/ws/conda
    CONDA_PROMPT_MODIFIER=(foobar)
         CONDA_PYTHON_EXE=/Users/Christopher.Barber/miniconda3/bin/python
               CONDA_ROOT=/Users/Christopher.Barber/miniconda3
              CONDA_SHLVL=3
          CONDA_STACKED_2=true
           CURL_CA_BUNDLE=<not set>
     JAVA_LD_LIBRARY_PATH=/Users/Christopher.Barber/miniconda3/lib/jvm/lib/server
               LD_PRELOAD=<not set>
                     PATH=/Users/Christopher.Barber/miniconda3/envs/foobar/bin:/Users/Christophe
                          r.Barber/miniconda3/bin:/Users/Christopher.Barber/miniconda3/condabin:
                          /Users/Christopher.Barber/bin:/usr/local/bin:/System/Cryptexes/App/usr
                          /bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/podman/bin:/var/run/com.apple.
                          security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.ap
                          ple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.appl
                          e.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Appl
                          ications/kdiff3.app/Contents/MacOS
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : foobar
    active env location : /Users/Christopher.Barber/miniconda3/envs/foobar
            shell level : 3
       user config file : /Users/Christopher.Barber/.condarc
 populated config files : /Users/Christopher.Barber/.condarc
                          /Users/Christopher.Barber/miniconda3/envs/foobar/.condarc
          conda version : 23.9.0
    conda-build version : 3.27.0
         python version : 3.11.5.final.0
       virtual packages : __archspec=1=m1
                          __osx=13.5.2=0
                          __unix=0=0
       base environment : /Users/Christopher.Barber/miniconda3  (writable)
      conda av data dir : /Users/Christopher.Barber/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/Christopher.Barber/miniconda3/pkgs
                          /Users/Christopher.Barber/.conda/pkgs
       envs directories : /Users/Christopher.Barber/miniconda3/envs
                          /Users/Christopher.Barber/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.9.0 requests/2.31.0 CPython/3.11.5 Darwin/22.6.0 OSX/13.5.2 solver/libmamba conda-libmamba-solver/23.7.0 libmambapy/1.5.3
                UID:GID : 502:20
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
If you suspect this error is being caused by a malfunctioning plugin,
consider using the --no-plugins option to turn off plugins.

Example: conda --no-plugins install <package>

Alternatively, you can set the CONDA_NO_PLUGINS environment variable on
the command line to run the command without plugins enabled.

Example: CONDA_NO_PLUGINS=true conda install <package>

Upload successful.

@jaimergp
Copy link
Contributor

jaimergp commented Jan 9, 2024

Thanks! Opened #421 with a reproducer test and a fix is on the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type
Projects
Archived in project
3 participants