From 6e82bd4c64fe8563f6b744ef4b9d951e8744bbac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 9 Mar 2026 12:14:00 +0100 Subject: [PATCH] GH-49473: [Python] Fix get_include and get_library_dirs to work with both editable and non-editable installs --- python/pyarrow/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py index 27655e5cdab..adfc50d5739 100644 --- a/python/pyarrow/__init__.py +++ b/python/pyarrow/__init__.py @@ -305,7 +305,11 @@ def get_include(): Return absolute path to directory containing Arrow C++ include headers. Similar to numpy.get_include """ - return _os.path.join(_os.path.dirname(__file__), 'include') + # Use pyarrow.lib location instead of just __file__. That works + # for both editable and non-editable builds as it points + # to the actual location of the compiled C++ extension. + from pyarrow import lib as _lib + return _os.path.join(_os.path.dirname(_lib.__file__), 'include') def _get_pkg_config_executable(): @@ -388,7 +392,11 @@ def get_library_dirs(): Return lists of directories likely to contain Arrow C++ libraries for linking C or Cython extensions using pyarrow """ - package_cwd = _os.path.dirname(__file__) + # Use pyarrow.lib location instead of just __file__. That works + # for both editable and non-editable builds as it points + # to the actual location of the compiled C++ extension. + from pyarrow import lib as _lib + package_cwd = _os.path.dirname(_lib.__file__) library_dirs = [package_cwd] def append_library_dir(library_dir):