pip: Flit's dynamic description is not working with pip 22.2 along with python 3.8, 3.9

Minimal reproduction: https://github.com/furiosamg/flit-dynamic-pip-22

I think flit’s dynamic description generation is broken in pip 22.2. When trying to install above package with pip 22.2, following error occurred.

$ pip install pip==22.2 && pip install .
Looking in indexes: https://pypi.org/simple, https://internal-pypi.furiosa.dev/simple
Requirement already satisfied: pip==22.2 in /root/miniconda3/envs/env-3.9/lib/python3.9/site-packages (22.2)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Looking in indexes: https://pypi.org/simple, https://internal-pypi.furiosa.dev/simple
Processing /root/flit-dynamic-pip-22
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 2
  ╰─> [45 lines of output]
      Looking in indexes: https://pypi.org/simple, https://internal-pypi.furiosa.dev/simple, https://internal-pypi.furiosa.dev/simple
      Collecting flit_core<4,>=3.2
        Using cached flit_core-3.7.1-py3-none-any.whl (60 kB)
      Installing collected packages: flit_core
      /root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py:103: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
        warnings.warn(msg, _ExperimentalProjectMetadata)
      ERROR: Exception:
      Traceback (most recent call last):
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
          status = run_func(*args)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
          return func(self, options, args)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 461, in run
          installed = install_given_reqs(
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip/_internal/req/__init__.py", line 73, in install_given_reqs
          requirement.install(
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 752, in install
          scheme = get_scheme(
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip/_internal/locations/__init__.py", line 246, in get_scheme
          old = _distutils.get_scheme(
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 130, in get_scheme
          scheme = distutils_scheme(dist_name, user, home, root, isolated, prefix)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 46, in distutils_scheme
          d.parse_config_files()
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/dist.py", line 854, in parse_config_files
          pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 55, in apply_configuration
          config = read_configuration(filepath, True, ignore_option_errors, dist)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 135, in read_configuration
          return expand_configuration(asdict, root_dir, ignore_option_errors, dist)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 190, in expand_configuration
          return _ConfigExpander(config, root_dir, ignore_option_errors, dist).expand()
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 237, in expand
          self._expand_all_dynamic(dist, package_dir)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 272, in _expand_all_dynamic
          obtained_dynamic = {
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 273, in <dictcomp>
          field: self._obtain(dist, field, package_dir)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 310, in _obtain
          self._ensure_previously_set(dist, field)
        File "/root/miniconda3/envs/env-3.9/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 296, in _ensure_previously_set
          raise OptionError(msg)
      distutils.errors.DistutilsOptionError: No configuration found for dynamic 'description'.
      Some dynamic fields need to be specified via `tool.setuptools.dynamic`
      others must be specified via the equivalent attribute in `setup.py`.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (8 by maintainers)

Commits related to this issue

Most upvoted comments

OK, could someone test and confirm that #11298 fixes the issue for them?

thank you very much for posting this, @furiosamg!

we ran into a related problem over in sourmash, https://github.com/sourmash-bio/sourmash/issues/2139, where our ReadTheDocs build was failing with python3.8 and pip 22.2.

I verified that downgrading to pip 22.1.2 fixed the problem, as did upgrading to python3.10 in the conda environment used for building the docs. I’m trying the latter out for the readthedocs fix.

Nothing to be done, just wanted to chime in with another breaking build! Happy to help test or debug things if and as it would be helpful.

(If others are having problems with pip 22.2 and readthedocs build, here is our fix)

I’ll move this over to pip, since we need to make a change on pip’s end.

Ah, well, that’s interesting and would fix the immediate bleeding. I think it’s reasonable for us to do a sys.meta_path.append(...) instead of the sys.meta_path.insert(0, ...).

We actually changed this to the start on the rationale that no one else should try modifying pip before us (https://github.com/pypa/pip/pull/11257#discussion_r921138585) but setuptools use case seems like a reasonable one.