AttributeError:"super" object has no attribute "get_params"

87 views
Skip to first unread message

Danesh Lachman

unread,
Aug 15, 2024, 5:45:02 AM8/15/24
to PyInstaller
Hi,

I am working on a simple PySimpleGUI interface where I want to make use of the package lightgbm to make a prediction on a model we have. When I run the code as a python file everything runs fine but after turning it to an executable and trying to use a .predict function from lightgbm it crashes when I use it as an executable. The application was working as an executable when using Lightgbm version 3 but now as we upgraded to version 4 it crashes in the exe. As pyinstaller could not find lightgbm before I put it in the hidden_imports and this was working until we upgraded to lightgbm version 4. I am getting the following error: 

Traceback (most recent call last):
  File "avm_application.py", line 312, in <module>
  File "lightgbm\sklearn.py", line 899, in predict
  File "lightgbm\sklearn.py", line 638, in _process_params
  File "lightgbm\sklearn.py", line 600, in get_params
AttributeError: 'super' object has no attribute 'get_params'

Line 312 in my code is the following: 
lightGBM_pred = LightGBM.predict(df_avm)

Where df_avm is my dataframe I am trying to predict with the model we have built, and as I said, this works when executed in regular Python. 

I have looked into the hooks but have not found how this would solve the problem I am currently having. 

Thanks for reading already.

bwoodsend

unread,
Aug 15, 2024, 8:53:39 AM8/15/24
to PyInstaller

The attribute error comes from this placeholder class which is used if one of these sklearn imports fail. The placeholder class is a bug in LightGBM’s optional dependency handling but that’s only obfuscating the real issue which is figuring out why those sklearn imports fail in the first place. The easiest way to do that would be to edit your local copy of LightGBM, inserting a raise here then rebuild and post the new error message here.

Danesh Lachman

unread,
Aug 15, 2024, 10:11:03 AM8/15/24
to PyInstaller
Have successfully resolved the issue, thanks!

Op donderdag 15 augustus 2024 om 14:53:39 UTC+2 schreef bwoodsend:
Reply all
Reply to author
Forward
0 new messages