Skip to content

Reinstallation of dependencies of setuptools_scm fails with packaging-related packages #32751

@vbraun

Description

@vbraun

Reinstallation of a dependency of setuptools_scm fails and breaks the Python build system. Steps to reproduce:

make distclean
make setuptools_scm
sage -f packaging

Expected behavior is to rebuild, actually get

****************************************************
Uninstalling existing 'packaging'
Running pip-uninstall script for 'packaging'
Found existing installation: packaging 21.0
Uninstalling packaging-21.0:
  Successfully uninstalled packaging-21.0
Removing stamp file '/home/vbraun/Sage/git/local/var/lib/sage/installed/packaging-21.0'
Installing packaging-21.0
Processing /home/vbraun/Sage/git/local/var/tmp/sage/build/packaging-21.0/src
    Preparing wheel metadata: started
    Running command /home/vbraun/Sage/git/local/bin/python3 /home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpdfyrpf_j
    Traceback (most recent call last):
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
        main()
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 151, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/setuptools/build_meta.py", line 166, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 40, in <module>
        setup(
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/setuptools/_distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/setuptools/dist.py", line 450, in __init__
        _Distribution.__init__(
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/setuptools/_distutils/dist.py", line 293, in __init__
        self.finalize_options()
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/setuptools/dist.py", line 827, in finalize_options
        for ep in sorted(loaded, key=by_order):
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/setuptools/dist.py", line 826, in <lambda>
        loaded = map(lambda e: e.load(), filtered)
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 2449, in load
        self.require(*args, **kwargs)
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 2472, in require
        items = working_set.resolve(reqs, env, installer, extras=self.extras)
      File "/home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve
        raise DistributionNotFound(req, requirers)
    pkg_resources.DistributionNotFound: The 'packaging>=20.0' distribution was not found and is required by the application
    Preparing wheel metadata: finished with status 'error'
WARNING: Discarding file:///home/vbraun/Sage/git/local/var/tmp/sage/build/packaging-21.0/src. Command errored out with exit status 1: /home/vbraun/Sage/git/local/bin/python3 /home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpdfyrpf_j Check the logs for full command output.
ERROR: Command errored out with exit status 1: /home/vbraun/Sage/git/local/bin/python3 /home/vbraun/Sage/git/local/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpdfyrpf_j Check the logs for full command output.
************************************************************************************************************************************************************
Error building a wheel for packaging-21.0
************************************************************************************************************************************************************

Inserting some debug printing in require line 2474 reveals

self = EntryPoint.parse('setuptools_scm = setuptools_scm.integration:infer_version'), 
reqs = [Requirement.parse('setuptools'), Requirement.parse('tomli>=1.0.0'), Requirement.parse('packaging>=20.0')], None, None, ()]

This is because

cat venv/lib/python3.9/site-packages/setuptools_scm-6.3.2.dist-info/METADATA
[...]
Requires-Dist: packaging (>=20.0)
Requires-Dist: setuptools
Requires-Dist: tomli (>=1.0.0)
Provides-Extra: toml
Requires-Dist: setuptools (>=42) ; extra == 'toml'
Requires-Dist: tomli (>=1.0.0) ; extra == 'toml'
[...]

Depends on #32659

CC: @vbraun @dimpase @jhpalmieri @mkoeppe

Component: build

Author: Matthias Koeppe

Branch/Commit: 8f3bd8f

Reviewer: John Palmieri, Volker Braun

Issue created by migration from https://trac.sagemath.org/ticket/32751

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions