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

Cannot install project with pyproject.toml having dependency from local git repository (git+file://) #11709

Closed
1 task done
JoakimJoensuu opened this issue Jan 7, 2023 · 1 comment
Labels
type: bug A confirmed bug or unintended behavior

Comments

@JoakimJoensuu
Copy link

Description

Running pip install "git+file:///home/user/repository/.git#subdirectory=library" works.

But having similiar dependency in pyproject.toml doesn't work. Running pip install . while having following toml file in the same folder gives following error.

[project]
name = "application"
version = "1.0.0"
description = "Simple application"
requires-python = ">=3.11"

dependencies = [
    "library @ git+file:///home/user/repository/.git#subdirectory=library",
]
Error message
Processing /home/user/repository/application
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [52 lines of output]
      configuration error: `project.dependencies[{data__dependencies_x}]` must be pep508
      DESCRIPTION:
          Project dependency specification according to PEP 508
      
      GIVEN VALUE:
          "library @ git+file:///home/user/repository/.git#subdirectory=library"
      
      OFFENDING RULE: 'format'
      
      DEFINITION:
          {
              "$id": "#/definitions/dependency",
              "title": "Dependency",
              "type": "string",
              "format": "pep508"
          }
      Traceback (most recent call last):
        File "/home/user/repository/application/.venv/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/user/repository/application/.venv/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/user/repository/application/.venv/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 485, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 1, in <module>
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 159, in setup
          dist.parse_config_files()
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 867, in parse_config_files
          pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 62, in apply_configuration
          config = read_configuration(filepath, True, ignore_option_errors, dist)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 126, in read_configuration
          validate(subset, filepath)
        File "/tmp/pip-build-env-m1nfldav/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 51, in validate
          raise ValueError(f"{error}\n{summary}") from None
      ValueError: invalid pyproject.toml config: `project.dependencies[{data__dependencies_x}]`.
      configuration error: `project.dependencies[{data__dependencies_x}]` must be pep508
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

Expected behavior

I'd expect to see successfull installation:

Processing /home/user/repository/application
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Processing /home/user/repository/library
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: application, library
  Building wheel for application (pyproject.toml) ... done
  Created wheel for application: filename=application-1.0.0-py3-none-any.whl size=3824 sha256=54e3fe17b500d6ef6d39a9b4685e503c8c8f769353c37902ef5764f15150a3d6
  Stored in directory: /tmp/pip-ephem-wheel-cache-dszxuqcb/wheels/eb/66/2c/8a0575464550cec1aacc721d7ba15d9af503daece8e3ddc84a
  Building wheel for library (pyproject.toml) ... done
  Created wheel for library: filename=library-1.0.0-py3-none-any.whl size=1366 sha256=d40643f2f583ed109cd87d416a5e863d9855fe4b1f6c3db1f6fd5e416683620b
  Stored in directory: /tmp/pip-ephem-wheel-cache-dszxuqcb/wheels/c3/ab/3a/9d1bd4288b05710825742a964449a1b2a4c35794f98f146b96
Successfully built application library
Installing collected packages: library, application
Successfully installed application-1.0.0 library-1.0.0

pip version

pip 22.0.2

Python version

3.11

OS

Ubuntu 22.04.1 LTS

How to Reproduce

  1. Clone my repo git clone git@github.com:JoakimJoensuu/pyproject.toml-example.git
  2. In application/pyproject.toml change "library @ git+file:///absolute/path/to/this/repo/.git#subdirectory=library" to point wherever you cloned the repo.
  3. cd to application-folder
  4. python3.11 -m venv .venv
  5. source .venv/bin/activate
  6. pip install .

Output

Processing /home/user/Downloads/pyproject.toml-example/application
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [52 lines of output]
      configuration error: `project.dependencies[{data__dependencies_x}]` must be pep508
      DESCRIPTION:
          Project dependency specification according to PEP 508
      
      GIVEN VALUE:
          "library @ git+file:///home/user/Downloads/pyproject.toml-example/.git#subdirectory=library"
      
      OFFENDING RULE: 'format'
      
      DEFINITION:
          {
              "$id": "#/definitions/dependency",
              "title": "Dependency",
              "type": "string",
              "format": "pep508"
          }
      Traceback (most recent call last):
        File "/home/user/Downloads/pyproject.toml-example/application/.venv/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/user/Downloads/pyproject.toml-example/application/.venv/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/user/Downloads/pyproject.toml-example/application/.venv/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 485, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 1, in <module>
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 159, in setup
          dist.parse_config_files()
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 867, in parse_config_files
          pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 62, in apply_configuration
          config = read_configuration(filepath, True, ignore_option_errors, dist)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 126, in read_configuration
          validate(subset, filepath)
        File "/tmp/pip-build-env-3y3cdtli/overlay/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 51, in validate
          raise ValueError(f"{error}\n{summary}") from None
      ValueError: invalid pyproject.toml config: `project.dependencies[{data__dependencies_x}]`.
      configuration error: `project.dependencies[{data__dependencies_x}]` must be pep508
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

Code of Conduct

@JoakimJoensuu JoakimJoensuu added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jan 7, 2023
@sbidoul
Copy link
Member

sbidoul commented Jan 7, 2023

This sounds like #7650, which is blocked on pypa/packaging#264. So closing.

@sbidoul sbidoul closed this as completed Jan 7, 2023
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Jan 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants