Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Error Runing LightGBM "TypeError: expected c_char_p instance instead of int" #8

Open
JinShng opened this issue Nov 26, 2021 · 0 comments

Comments

@JinShng
Copy link

JinShng commented Nov 26, 2021

Use Linux(centos7), Runing LightGBM In Pypy3, An exception occurs when I run the following code

import joblib

lgb = joblib.load('./catigory_xh.pkl')

for k in lgb.feature_name():
    print(k);

Error Info

Traceback (most recent call last):
  File "/usr/local/src/pypy3.6/lib_pypy/_ctypes/basics.py", line 56, in from_param
    as_parameter = value._as_parameter_
AttributeError: 'int' object has no attribute '_as_parameter_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "model.py", line 5, in <module>
    for k in lgb.feature_name():
  File "/usr/local/src/pypy3.6/site-packages/lightgbm/basic.py", line 3655, in feature_name
    ptr_string_buffers = (ctypes.c_char_p * num_feature)(*map(ctypes.addressof, string_buffers))
  File "/usr/local/src/pypy3.6/lib_pypy/_ctypes/array.py", line 203, in __init__
    self[i] = arg
  File "/usr/local/src/pypy3.6/lib_pypy/_ctypes/array.py", line 229, in __setitem__
    cobj = self._type_.from_param(value)
  File "/usr/local/src/pypy3.6/lib_pypy/_ctypes/primitive.py", line 372, in from_param
    return super(SimpleType, self).from_param(value)
  File "/usr/local/src/pypy3.6/lib_pypy/_ctypes/basics.py", line 59, in from_param
    self.__name__, type(value).__name__))
TypeError: expected c_char_p instance instead of int

LightGBM version:

Name: lightgbm
Version: 3.3.1
Summary: LightGBM Python Package
Home-page: https://github.com/microsoft/LightGBM
Author: 
Author-email: 
License: The MIT License (Microsoft)
Location: /usr/local/src/pypy3.6/site-packages
Requires: numpy, scikit-learn, scipy, wheel
Required-by: 

Pypy Version:

Python 3.6.12 (db1e853f94de, Nov 18 2020, 09:49:19)
[PyPy 7.3.3 with GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]

In fact, I have tried in other versions, and the error is the same
catigory_xh.pkl

@JinShng JinShng changed the title Error Runing In Pypy3 "TypeError: expected c_char_p instance instead of int" Error Runing In LightGBM "TypeError: expected c_char_p instance instead of int" Nov 26, 2021
@JinShng JinShng changed the title Error Runing In LightGBM "TypeError: expected c_char_p instance instead of int" Error Runing LightGBM "TypeError: expected c_char_p instance instead of int" Nov 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant