Model = xgb.XGBClassifier() gives an error

I have no idea how to handle this error when i run the deployed app.
The problem is under the button “Price forecats”

the code in short:
import xgboost as xgb
model = xgb.XGBClassifier() # this is an Error

The xboost version is 1.6.1

Thankfull for any help!

Hi there,

Thanks for sharing your question with the community! Check out our guidelines on how to post an effective question here – in particular, please format your code properly and include the full error message that you’re seeing.

Caroline :balloon:

I’m sorry if I didn’t format the code properly. It’s just a very short code snippet and I really don’t know how to format it differently.
Is this better?

import xgboost as xgb
model = xgb.XGBClassifier()  # this is an Error

The error message that I can see is:

xgboost.core.XGBoostError: This app has encountered an error. The original error message is redacted to prevent data leaks. 
Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).

File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/", line 562, in _run_script
    exec(code, module.__dict__)
File "/app/the_new_krypto/", line 310, in <module>
    tomorrow_up = load_and_predict('BTC_y1.json', BTC_data1, new_predictors)
File "/app/the_new_krypto/", line 257, in load_and_predict
    model = xgb.XGBClassifier()
File "/home/appuser/venv/lib/python3.9/site-packages/xgboost/", line 532, in inner_f
    return f(**kwargs)
File "/home/appuser/venv/lib/python3.9/site-packages/xgboost/", line 1314, in __init__
    super().__init__(objective=objective, **kwargs)
File "/home/appuser/venv/lib/python3.9/site-packages/xgboost/", line 528, in __init__
    raise XGBoostError(

When I click ‘Manage app’ link it opens up a log that exceeds the size of my screen and I am suposed to find “︙” overflow menu in bottom but it’s not there.

The link to my github repo is:
and the requierements.txt is found there.

The link to the deployed app at the streamlit cloud is in my original post above.

I am using windows 11, VS Code, streamlit 1.13.0 and python 3.9.13
I have tried different versions of xgboost with the same error.

The app is working locally on my machine.

I hope I made it right this time.

You don’t need any overflow menu. Just scroll up to the beginnig of the relevant log entry (the timestamp), copy everything from there to the end, paste it here and format it as preformatted text.

Anyway, if your “Manage app” panel doesn’t look and behave as described in the docs, you have a more fundamental issue. If that is the case I would try to replicate it with a simple “hello world” application with no dependencies (no requirement.txt, packages.txt, etc.)

I forked your repo and deployed the app, the “Manage app” panel looks and works as expected.

This is what the actual error message says:

xgboost.core.XGBoostError: sklearn needs to be installed in order to use this module
1 Like

sklearn in requirements solved the problem.
Thank you very much!
The issue with Manage app is because I can’t scroll down the log with the mouse (maybe I’m stupid but I can’t)
But with shift+downarrow I could reach the bottom of the log!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.