@@ -132,16 +132,28 @@ def locate_or_build_libxgboost(
132
132
133
133
if build_config .use_system_libxgboost :
134
134
# Find libxgboost from system prefix
135
- sys_base_prefix = pathlib .Path (sys .base_prefix ).absolute ().resolve ()
136
- libxgboost_sys = sys_base_prefix / "lib" / _lib_name ()
137
- if not libxgboost_sys .exists ():
138
- raise RuntimeError (
139
- f"use_system_libxgboost was specified but { _lib_name ()} is "
140
- f"not found in { libxgboost_sys .parent } "
141
- )
142
-
143
- logger .info ("Using system XGBoost: %s" , str (libxgboost_sys ))
144
- return libxgboost_sys
135
+ sys_prefix = pathlib .Path (sys .prefix )
136
+ sys_prefix_candidates = [
137
+ sys_prefix / "lib" ,
138
+ # Paths possibly used on Windows
139
+ sys_prefix / "bin" ,
140
+ sys_prefix / "Library" ,
141
+ sys_prefix / "Library" / "bin" ,
142
+ sys_prefix / "Library" / "lib" ,
143
+ ]
144
+ sys_prefix_candidates = [
145
+ p .expanduser ().resolve () for p in sys_prefix_candidates
146
+ ]
147
+ for candidate_dir in sys_prefix_candidates :
148
+ libtreelite_sys = candidate_dir / _lib_name ()
149
+ if libtreelite_sys .exists ():
150
+ logger .info ("Using system XGBoost: %s" , str (libtreelite_sys ))
151
+ return libtreelite_sys
152
+ raise RuntimeError (
153
+ f"use_system_libxgboost was specified but { _lib_name ()} is "
154
+ f"not found. Paths searched (in order): \n "
155
+ + "\n " .join ([f"* { str (p )} " for p in sys_prefix_candidates ])
156
+ )
145
157
146
158
libxgboost = locate_local_libxgboost (toplevel_dir , logger = logger )
147
159
if libxgboost is not None :
0 commit comments