Skip to content

Conversation

@larryliu0820
Copy link
Contributor

@larryliu0820 larryliu0820 commented Nov 21, 2025

Summary:
This PR fixes two issues affecting the build and installation process:

  1. pyproject.toml configuration: Fixed invalid license and license-files fields that were causing build failures with newer versions of setuptools and pip build isolation. The license field now uses the table format {text = ...} and license-files was moved to [tool.setuptools].

  2. Editable install version.py: Fixed an issue where version.py was being written to the project root instead of the package directory (src/executorch) during editable installs. This was causing ImportError: cannot import name 'version' when importing executorch.

Test Plan:

  • Verified pip install . --no-build-isolation works (metadata generation succeeds).
  • Verified pip install -e . --no-build-isolation works and from executorch import version succeeds.

Summary

[PLEASE REMOVE] See CONTRIBUTING.md's Pull Requests for ExecuTorch PR guidelines.

[PLEASE REMOVE] If this PR closes an issue, please add a Fixes #<issue-id> line.

[PLEASE REMOVE] If this PR introduces a fix or feature that should be the upcoming release notes, please add a "Release notes: " label. For a list of available release notes labels, check out CONTRIBUTING.md's Pull Requests.

Test plan

[PLEASE REMOVE] How did you test this PR? Please write down any manual commands you used and note down tests that you have written if applicable.

cc @GregoryComer

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 21, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15941

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 1 Pending

As of commit bd35c44 with merge base 23fc78f (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 21, 2025
@larryliu0820 larryliu0820 added module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch release notes: build Changes related to build, including dependency upgrades, build flags, optimizations, etc. labels Nov 21, 2025
@larryliu0820 larryliu0820 force-pushed the fix/build-and-editable-install branch from 0008c52 to dda7b84 Compare November 21, 2025 18:15
if self.editable_mode:
# In editable mode, the package directory is the original source directory
dst_root = self.get_package_dir(".")
dst_root = self.get_package_dir("executorch")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, is this the symlinked folder or the actual source folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the one under src/, so src/executorch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like tests are failing to build the package with the change.

Copy link
Contributor Author

@larryliu0820 larryliu0820 Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just rebased, let's see

Summary:
This PR fixes two issues affecting the build and installation process:

1.  **pyproject.toml configuration**: Fixed invalid `license` and `license-files` fields that were causing build failures with newer versions of `setuptools` and `pip` build isolation. The `license` field now uses the table format `{text = ...}` and `license-files` was moved to `[tool.setuptools]`.

2.  **Editable install version.py**: Fixed an issue where `version.py` was being written to the project root instead of the package directory (`src/executorch`) during editable installs. This was causing `ImportError: cannot import name 'version'` when importing `executorch`.

Test Plan:
- Verified `pip install . --no-build-isolation` works (metadata generation succeeds).
- Verified `pip install -e . --no-build-isolation` works and `from executorch import version` succeeds.
@larryliu0820 larryliu0820 force-pushed the fix/build-and-editable-install branch from dda7b84 to bd35c44 Compare November 21, 2025 18:36
@mergennachin
Copy link
Contributor

It would be good to validate whether the new format in your PR is compatible with 77.0.3

@larryliu0820
Copy link
Contributor Author

It would be good to validate whether the new format in your PR is compatible with 77.0.3

Oh I think v75.8.0 is the version with this error:

(executorch) larryliu@larryliu-mac executorch % pip install . --no-build-isolation
Processing /Users/larryliu/executorch
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [38 lines of output]
      Traceback (most recent call last):
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 175, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/setuptools/build_meta.py", line 377, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
          exec(code, locals())
        File "<string>", line 777, in <module>
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 160, in setup
          dist.parse_config_files()
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/setuptools/dist.py", line 652, in parse_config_files
          pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 72, in apply_configuration
          config = read_configuration(filepath, True, ignore_option_errors, dist)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 140, in read_configuration
          validate(subset, filepath)
        File "/Users/larryliu/miniconda3/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 61, 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']
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

v77.0.3 works well.

v80.9.0 works well.

@larryliu0820 larryliu0820 merged commit 0c3d779 into main Nov 21, 2025
166 of 167 checks passed
@larryliu0820 larryliu0820 deleted the fix/build-and-editable-install branch November 21, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch release notes: build Changes related to build, including dependency upgrades, build flags, optimizations, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants