Skip to content

Installing FlashInfer from source failed due to an invalid format in the pyproject.toml file. #2544

@thenumberouscode

Description

@thenumberouscode

I am installing flashinfer using the following command from official guide:

python -m pip install --no-build-isolation -e . -v

however it failed

Traceback (most recent call last):
    File "/opt/conda/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/opt/conda/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/conda/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 181, in prepare_metadata_for_build_editable
      return hook(metadata_directory, config_settings)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/workspace/flashinfer/build_backend.py", line 164, in prepare_metadata_for_build_editable
      return orig.prepare_metadata_for_build_editable(metadata_directory, config_settings)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/conda/lib/python3.11/site-packages/setuptools/build_meta.py", line 453, in prepare_metadata_for_build_editable
      return self.prepare_metadata_for_build_wheel(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/conda/lib/python3.11/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "/opt/conda/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 1, in <module>
    File "/opt/conda/lib/python3.11/site-packages/setuptools/__init__.py", line 104, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/conda/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 158, in setup
      dist.parse_config_files()
    File "/opt/conda/lib/python3.11/site-packages/setuptools/dist.py", line 631, in parse_config_files
      pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
    File "/opt/conda/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 68, in apply_configuration
      config = read_configuration(filepath, True, ignore_option_errors, dist)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/conda/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 129, in read_configuration
      validate(subset, filepath)
    File "/opt/conda/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 57, in validate
      raise ValueError(f"{error}\n{summary}") from None
  ValueError: invalid pyproject.toml config: `project.license`.
  configuration error: `project.license` must be valid exactly by one definition (2 matches found):

      - keys:
          'file': {type: string}
        required: ['file']
      - keys:
          'text': {type: string}
        required: ['text']

  error: subprocess-exited-with-error

it reminded me to use license = { text = "Apache-2.0" } instead of license = "Apache-2.0", and another fail occured, I had removed the license-files field. so my final pyproject.toml differs from master and it worked

git diff
diff --git a/pyproject.toml b/pyproject.toml
index 379b0a55..43536e1f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -17,11 +17,10 @@ name = "flashinfer-python"
 description = "FlashInfer: Kernel Library for LLM Serving"
 requires-python = ">=3.10,<4.0"
 authors = [{ name = "FlashInfer team" }]
-license = "Apache-2.0"
+license = { text = "Apache-2.0" }
 readme = "README.md"
 urls = { Homepage = "https://github.com/flashinfer-ai/flashinfer" }
 dynamic = ["dependencies", "version"]
-license-files = ["LICENSE", "LICENSE*.txt"]

 [project.scripts]
 flashinfer = "flashinfer.__main__:cli"

my flashinfer git commit id is 1d350ae, it should be the latest.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions