Skip to content

Transitive constraints are not properly considered in multiple output recipes #3308

@jjhelmus

Description

@jjhelmus

Transitive package constraints from a sub-package do not appear to be considered when rendering recipes with multiple outputs. This can result in an unnecessary UnsatisfiableError during the build.

For example for a recipe with two outputs:

package:
  name: foo_split
  version: 1.0.0

outputs:
  - name: libfoo
    requirements:
      host:
        - openssl

  - name: foo
    requirements:
      host:
        - python
        - {{ pin_subpackage('libfoo', exact=True) }}

Attempting to pin openssl to anything but the latest version will result in foo failing to build. For example with the following CBC.yaml file:

openssl:
  - 1.0.2
python:
  - 3.6

The recipe renders as:

$ conda render .
read filter "zstd" is not supported
write filter "zstd" is not supported
--------------
Hash contents:
--------------
{'openssl': '1.0.2'}
----------
meta.yaml:
----------
package:
    name: libfoo
    version: 1.0.0
build:
    noarch: false
requirements:
    host:
        - ca-certificates 2018.03.07 0
        - libgcc-ng 8.2.0 hdf63c60_1
        - openssl 1.0.2p h14c3975_0
    run:
        - openssl >=1.0.2p,<1.0.3a
outputs:
    -   name: libfoo
        requirements:
            host:
                - openssl
    -   name: foo
        requirements:
            host:
                - python
                - libfoo 1.0.0 0
extra:
    copy_test_source_files: true
    final: true
    parent_recipe:
        name: foo_split
        path: /home/jhelmus/workspace/one_offs/cb_multi_out_bug
        version: 1.0.0

--------------
Hash contents:
--------------
{}
----------
meta.yaml:
----------
package:
    name: foo
    version: 1.0.0
build:
    noarch: false
requirements:
    host:
        - ca-certificates 2018.03.07 0
        - libgcc-ng 8.2.0 hdf63c60_1
        - libstdcxx-ng 8.2.0 hdf63c60_1
        - libffi 3.2.1 hd88cf55_4
        - ncurses 6.1 he6710b0_1
        - openssl 1.1.1a h7b6447c_0
        - xz 5.2.4 h14c3975_4
        - zlib 1.2.11 h7b6447c_3
        - libedit 3.1.20170329 h6b74fdf_2
        - readline 7.0 h7b6447c_5
        - tk 8.6.8 hbc83047_0
        - sqlite 3.25.3 h7b6447c_0
        - python 3.6.7 h0371630_0
        - libfoo 1.0.0 hf82bc7d_0
outputs:
    -   name: libfoo
        requirements:
            host:
                - openssl
    -   name: foo
        requirements:
            host:
                - python
                - libfoo 1.0.0 hf82bc7d_0
extra:
    copy_test_source_files: true
    final: true
    parent_recipe:
        name: foo_split
        path: /home/jhelmus/workspace/one_offs/cb_multi_out_bug
        version: 1.0.0

Notice that in the second recipe openssl 1.1.1a is in the host section which will conflict with openssl constraint introduced by libfoo 1.0.0 via a run_export.

Building the recipe fails when solving an environment for the build of foo:

$ conda build .
...
Packaging libfoo-1.0.0-hf82bc7d_0
INFO:conda_build.build:Packaging libfoo-1.0.0-hf82bc7d_0
No files or script found for output libfoo
WARNING:conda_build.build:No files or script found for output libfoo
number of files: 0
Fixing permissions
Compressing to /tmp/tmpg2lhwuuh/libfoo-1.0.0-hf82bc7d_0.tar.bz2
Package verification results:
-----------------------------
/tmp/tmpg2lhwuuh/libfoo-1.0.0-hf82bc7d_0.tar.bz2: C1115 Found invalid license "None" in info/index.json
Packaging foo
INFO:conda_build.build:Packaging foo
Solving environment: ...working... failed

Leaving build/test directories:
  Work:
 /home/jhelmus/anaconda3/conda-bld/work 
  Test:
 /home/jhelmus/anaconda3/conda-bld/test_tmp 
Leaving build/test environments:
  Test:
source activate  /home/jhelmus/anaconda3/conda-bld/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold
_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p 
  Build:
source activate  /home/jhelmus/anaconda3/conda-bld/_build_env 


Traceback (most recent call last):
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda_build/environ.py", line 751, in get_install_actions
    actions = install_actions(prefix, index, specs, force=True)
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 46, in decorated
    return f(*args, **kwds)
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda/plan.py", line 541, in install_actions
    txn = solver.solve_for_transaction(prune=prune, ignore_pinned=not pinned)
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda/core/solve.py", line 518, in solve_for_transaction
    force_remove, force_reinstall)
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda/core/solve.py", line 451, in solve_for_diff
    final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove)
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda/core/solve.py", line 344, in solve_final_state
    solution = r.solve(tuple(final_environment_specs))  # return value is List[dist]
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 46, in decorated
    return f(*args, **kwds)
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda/resolve.py", line 857, in solve
    self.find_conflicts(specs)
  File "/home/jhelmus/anaconda3/lib/python3.6/site-packages/conda/resolve.py", line 244, in find_conflicts
    raise UnsatisfiableError(bad_deps)
conda.exceptions.UnsatisfiableError: The following specifications were found to be in conflict:
  - libfoo==1.0.0=hf82bc7d_0 -> openssl[version='>=1.0.2p,<1.0.3a']
  - openssl==1.1.1a=h7b6447c_0
Use "conda info <package>" to see the dependencies for each package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogissue has been triaged but has not been earmarked for any upcoming releaselocked[bot] locked due to inactivity

    Type

    No type

    Projects

    Status

    🏁 Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions