-
Notifications
You must be signed in to change notification settings - Fork 669
Add pybind extension to the DLL search path on Windows #14446
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/14446
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit b3933d8 with merge base 90ee347 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
||
# Update the DLL search path on Windows. This is the recommended way to handle native | ||
# extensions. | ||
if sys.platform == "win32": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if sys.platform.startswith("win"):
so that it can catch "win64" and "windows"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Win32 is actually the stable value for sys.platform for both 32-bit and 64-bit Windows builds. I'm happy to change it, though it seems like direct comparison to "win32" is the idiomatic appoach.
8cb5749
to
b3933d8
Compare
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.