mantidproject / mantidimaging

Graphical toolkit for neutron imaging.
https://mantidproject.github.io/mantidimaging
GNU General Public License v3.0
13 stars 6 forks source link

Conda package builds failing since python 3.12 update #2305

Closed samtygier-stfc closed 1 month ago

samtygier-stfc commented 1 month ago

Summary

The publish package workflow is currently failing: https://github.com/mantidproject/mantidimaging/actions/runs/10202443842/job/28226566696

The reported errors are:
- Encountered problems while solving:
-   - nothing provides _python_rc needed by python-3.12.0rc3-rc3_hab00c5b_1_cpython
- 

Steps To Reproduce

Happens when actions runs on a merge to main

Expected Behaviour

Builds package

Current Behaviour

Fails

Context

Happening since the Python 3.12 update

Failure Logs

Reloading output folder: /home/runner/miniconda3/envs/build-env/conda-bld
Traceback (most recent call last):
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/boa/cli/mambabuild.py", line 142, in mamba_get_package_records
Mamba failed to solve:
 - setuptools 62.*
    _, link_precs = solver.solve_for_unlink_link_precs(_specs, prefix)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/boa/core/solver.py", line 244, in solve_for_unlink_link_precs
    t = self.solve(specs)
        ^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/boa/core/solver.py", line 234, in solve
    raise RuntimeError("Solver could not find solution." + error_string)
RuntimeError: Solver could not find solution.Mamba failed to solve:
 - setuptools 62.*
 - python 3.12.*

with channels:

The reported errors are:
- Encountered problems while solving:
-   - nothing provides _python_rc needed by python-3.12.0rc3-rc3_hab00c5b_1_cpython
- 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/miniconda3/envs/build-env/bin/conda-mambabuild", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/boa/cli/mambabuild.py", line 301, in main
 - python 3.12.*

with channels:

The reported errors are:
- Encountered problems while solving:
-   - nothing provides _python_rc needed by python-3.12.0rc3-rc3_hab00c5b_1_cpython
- 

Leaving build/test directories:
  Work:
 /home/runner/miniconda3/envs/build-env/conda-bld/work 
  Test:
 /home/runner/miniconda3/envs/build-env/conda-bld/test_tmp 
Leaving build/test environments:
  Test:
source activate  /home/runner/miniconda3/envs/build-env/conda-bld/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac 
  Build:
source activate  /home/runner/miniconda3/envs/build-env/conda-bld/_build_env 

    call_conda_build(action, config)
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/boa/cli/mambabuild.py", line 273, in call_conda_build
    result = api.build(
             ^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/api.py", line 250, in build
    return build_tree(
           ^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/build.py", line 3638, in build_tree
    packages_from_this = build(
                         ^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/build.py", line 2308, in build
    output_metas = expand_outputs([(m, need_source_download, need_reparse_in_env)])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/render.py", line 916, in expand_outputs
    for output_dict, m in deepcopy(_m).get_output_metadata_set(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/metadata.py", line 2737, in get_output_metadata_set
    conda_packages = finalize_outputs_pass(
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/metadata.py", line 1095, in finalize_outputs_pass
    fm = finalize_metadata(
         ^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/render.py", line 650, in finalize_metadata
    build_unsat, host_unsat = add_upstream_pins(
                              ^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/render.py", line 465, in add_upstream_pins
    build_deps, build_unsat, extra_run_specs_from_build = _read_upstream_pin_files(
                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/render.py", line 444, in _read_upstream_pin_files
    deps, precs, unsat = get_env_dependencies(
                         ^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/conda_build/render.py", line 156, in get_env_dependencies
    precs = environ.get_package_records(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/miniconda3/envs/build-env/lib/python3.11/site-packages/boa/cli/mambabuild.py", line 151, in mamba_get_package_records
    raise err
conda_build.exceptions.DependencyNeedsBuildingError: Unsatisfiable dependencies for platform linux-64: {MatchSpec("python==3.12.0rc3=rc3_hab00c5b_1_cpython"), MatchSpec("_python_rc")}
samtygier-stfc commented 1 month ago

I think this is happening in the conda mambabuild $GITHUB_WORKSPACE/conda. possibly because the build-env is created with Python 3.11. It then tries to install python 3.12 and gets confused because it needs something older than 3.12.0 to stay happy with 3.11, but does not want to install an RC version.

samtygier-stfc commented 1 month ago

It is because conda-verify does not have a 3.12 supporting package on conda-forge https://github.com/conda-forge/conda-verify-feedstock/issues/40

samtygier-stfc commented 1 month ago

conda create -n build-env --yes boa anaconda-client conda-verify Gives a python 3.11 environment

conda create -n build-env --yes boa anaconda-client conda-verify python=3.12 Fails with error python 3.12** is not installable because there are no viable options

conda create -n build-env --yes boa anaconda-client Gives a python 3.12 environment

samtygier-stfc commented 1 month ago

Don't think we used verify, so maybe should just remove it.