[Bug 247408] misc/py-xgboost: python can't import xgboost.so

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jun 19 09:14:38 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247408

            Bug ID: 247408
           Summary: misc/py-xgboost: python can't import xgboost.so
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: yuri at freebsd.org
          Reporter: nomoo at nomoo.ru
             Flags: maintainer-feedback?(yuri at freebsd.org)
          Assignee: yuri at freebsd.org

Testing 11.4, quarterly and latest pkgs(py37-xgboost 1.0.2 and 1.1.1):
====================   8<   =======================
python3.7
Python 3.7.7 (default, Jun 16 2020, 01:12:14)
[Clang 8.0.0 (tags/RELEASE_800/final 356365)] on freebsd11
Type "help", "copyright", "credits" or "license" for more information.
>>> import xgboost
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/xgboost/__init__.py", line 11,
in <module>
    from .core import DMatrix, DeviceQuantileDMatrix, Booster
  File "/usr/local/lib/python3.7/site-packages/xgboost/core.py", line 175, in
<module>
    _LIB = _load_lib()
  File "/usr/local/lib/python3.7/site-packages/xgboost/core.py", line 134, in
_load_lib
    lib_paths = find_lib_path()
  File "/usr/local/lib/python3.7/site-packages/xgboost/libpath.py", line 45, in
find_lib_path
    dll_path = [os.path.join(p, 'libxgboost.so') for p in dll_path]
  File "/usr/local/lib/python3.7/site-packages/xgboost/libpath.py", line 45, in
<listcomp>
    dll_path = [os.path.join(p, 'libxgboost.so') for p in dll_path]
  File "/usr/local/lib/python3.7/posixpath.py", line 80, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
====================   8<   =======================

I used to solve it like this:
====================   8<   =======================
--- xgboost/libpath.py.orig     2020-03-02 05:10:11 UTC
+++ xgboost/libpath.py
@@ -4,6 +4,7 @@
 import os
 import platform
 import sys
+import sysconfig


 class XGBoostLibraryNotFound(Exception):
@@ -22,7 +23,8 @@ def find_lib_path():
     # make pythonpack hack: copy this directory one level upper for setup.py
     dll_path = [curr_path, os.path.join(curr_path, '../../lib/'),
                 os.path.join(curr_path, './lib/'),
-                os.path.join(sys.prefix, 'xgboost')]
+                os.path.join(sys.prefix, 'xgboost'),
+                sysconfig.get_config_var('LIBDIR')]
     if sys.platform == 'win32':
         if platform.architecture()[0] == '64bit':
             dll_path.append(os.path.join(curr_path,
'../../windows/x64/Release/'))
====================   8<   =======================

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list