Skip to content

Conversation

pytorchbot
Copy link
Collaborator

Summary

When installing ExecuTorch from a wheel on Windows, the native pybinding extension DLL fails to load (#14443). This is because it's not on the search path. From a quick Google search, it seems like the recommended way to handle this is to call os.add_dll_directory prior to loading the extension.

I tested this locally by installing from wheel in a clean env and then patching the installed copy in site-packages. With this change, I was able to import executorch.extension.pybindings.portable_lib. I also ran the XNNPACK add op tests as a sanity check, which use pybindings.

### Summary
When installing ExecuTorch from a wheel on Windows, the native pybinding
extension DLL fails to load
(#14443). This is because
it's not on the search path. From a quick Google search, it seems like
the recommended way to handle this is to call `os.add_dll_directory`
prior to loading the extension.

I tested this locally by installing from wheel in a clean env and then
patching the installed copy in site-packages. With this change, I was
able to import executorch.extension.pybindings.portable_lib. I also ran
the XNNPACK add op tests as a sanity check, which use pybindings.

(cherry picked from commit b1aed62)
Copy link

pytorch-bot bot commented Sep 22, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

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 Sep 22, 2025

# Update the DLL search path on Windows. This is the recommended way to handle native
# extensions.
if sys.platform == "win32":
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, if win32 is all there is for a windows platform, isn't there a 64 bit variant?

@abhinaykukkadapu abhinaykukkadapu merged commit a017509 into release/1.0 Sep 22, 2025
117 of 120 checks passed
@abhinaykukkadapu abhinaykukkadapu deleted the cherry-pick-14446-by-pytorch_bot_bot_ branch September 22, 2025 17:29
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants