-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
GH-45530: [Python][Packaging] Add pyarrow.libs dir to get_library_dirs #45766
GH-45530: [Python][Packaging] Add pyarrow.libs dir to get_library_dirs #45766
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
@github-actions crossbow submit wheel-windows-* |
Revision: f70dc96 Submitted crossbow builds: ursacomputing/crossbow @ actions-ba017247bc |
python/pyarrow/__init__.py
Outdated
pyarrow_libs_dir = _os.path.join( | ||
python_base_install, "Lib", "site-packages", "pyarrow.libs" | ||
) |
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.
I guess the Python stdlib includes a site
module that can give you the location of the current executable's site-packages
dir which may be a better approach than this.
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.
what if we use the current folder and substitute pyarrow
with pyarrow.libs
?
_os.path.dirname(_os.path.abspath(__file__))
--> that's how we add it below
It feels slightly hardcoded and I am not sure if all environments (virtualenv, system installed python, conda installed python) would replicate this folder structure.
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.
Even better, perhaps take a look at the kind of patch generated by delvewheel
itself, since it also has to compute the path to the mangled dependencies.
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.
Thanks!
Delvewheel uses a patch similar to what @raulcd mentions. From our patched wheel,
# start delvewheel patch
def _delvewheel_patch_1_10_0():
import os
if os.path.isdir(libs_dir := os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'pyarrow.libs'))):
os.add_dll_directory(libs_dir)
I'll try this out.
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.
Changed in 9e2526c. Testing now.
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.
It looks like that worked. From the raw log:
|
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.
+1
Thanks!!!
python/pyarrow/__init__.py
Outdated
pyarrow_libs_dir = _os.path.join( | ||
python_base_install, "Lib", "site-packages", "pyarrow.libs" | ||
) |
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.
Hmm, no, this is inflexible. Packages are indeed often installed in site-packages
, but they could be elsewhere on PYTHONPATH
.
I think this should really be using the pyarrow.libs
directory that is next to the current package's directory.
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.
Changed in 9e2526c. Testing now.
@github-actions crossbow submit wheel-windows-* |
Revision: 9e2526c Submitted crossbow builds: ursacomputing/crossbow @ actions-472ec229f4 |
I pushed up a few changes to address PR feedback and this PR is now passing on crossbow and is ready for a final review. Edit: Pushed one more minor change after I wrote this. |
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.
Thanks @amoeba
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit bc0b858. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 3 possible false positives for unstable benchmarks that are known to sometimes produce them. |
Rationale for this change
To run
test_cython
on Windows, we need a copy of msvcp140.dll in the library search path.What changes are included in this PR?
pa.get_library_dirs()
behavior to add thepyarrow.libs
folder to the library search pathAre these changes tested?
Not yet.
Are there any user-facing changes?
Only a bugfix.
Closes #45530