# Getting an Error while deploying xgb model

**URL:** <https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172>\
**Category:** Show the Community!\
**Tags:** file-upload, streamlit-cloud, discussion\
**Created:** [August 31, 2024, 4:45pm UTC](https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172 "2024-08-31T16:45:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![VivekGangurde](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/vivekgangurde/32/38434_2.png) [@VivekGangurde](https://discuss.streamlit.io/u/VivekGangurde)\
**Post date:** [August 31, 2024, 4:45pm UTC](https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172/1 "2024-08-31T16:45:12Z")

</div>

AttributeError: 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).

Traceback:

```auto
File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
    result = func()
             ^^^^^^File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 590, in code_to_exec
    exec(code, module. __dict__ )File "/mount/src/hr-analytics---project/model.py", line 163, in <module>
    main()File "/mount/src/hr-analytics---project/model.py", line 157, in main
    model = pickle.load(open('test.pkl','rb'))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

---

<div class="post-metadata">

**Author:** ![SiddhantSadangi](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/siddhantsadangi/32/68895_2.png) [@SiddhantSadangi](https://discuss.streamlit.io/u/SiddhantSadangi)\
**Post date:** [September 1, 2024, 10:02am UTC](https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172/2 "2024-09-01T10:02:26Z")

</div>

does `test.pkl` exist in your repo’s root?

---

<div class="post-metadata">

**Author:** ![VivekGangurde](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/vivekgangurde/32/38434_2.png) [@VivekGangurde](https://discuss.streamlit.io/u/VivekGangurde)\
**Post date:** [September 1, 2024, 3:59pm UTC](https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172/3 "2024-09-01T15:59:11Z")

</div>

@SiddhantSadangi  
yes test.pkl existed in repo’s root.

---

<div class="post-metadata">

**Author:** ![SiddhantSadangi](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/siddhantsadangi/32/68895_2.png) [@SiddhantSadangi](https://discuss.streamlit.io/u/SiddhantSadangi)\
**Post date:** [September 1, 2024, 5:20pm UTC](https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172/4 "2024-09-01T17:20:20Z")

</div>

Please share the full traceback and link to the repo

---

<div class="post-metadata">

**Author:** ![VivekGangurde](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/vivekgangurde/32/38434_2.png) [@VivekGangurde](https://discuss.streamlit.io/u/VivekGangurde)\
**Post date:** [September 1, 2024, 7:02pm UTC](https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172/5 "2024-09-01T19:02:29Z")

</div>

Here is the link for github repo,  
[GitHub - VivekGangurde/HR-Analytics---Project](https://github.com/VivekGangurde/HR-Analytics---Project/tree/main).

The source code for deployment on streamlit file is also available there-“model.py”.  
Is there an issue with ML model or something else?

---

<div class="post-metadata">

**Author:** ![SiddhantSadangi](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/siddhantsadangi/32/68895_2.png) [@SiddhantSadangi](https://discuss.streamlit.io/u/SiddhantSadangi)\
**Post date:** [September 1, 2024, 7:47pm UTC](https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172/6 "2024-09-01T19:47:54Z")

</div>

Please post the complete traceback from next time onwards (not only here, but in all support forums).

In your case, this is the error

```auto
AttributeError: Can't get attribute 'XGBoostLabelEncoder' on <module 'xgboost.compat' from 'C:\\Users\\siddh\\python_envs\\py310\\lib\\site-packages\\xgboost\\compat.py'>
Traceback:
File "C:\Users\siddh\python_envs\py310\lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 88, in exec_func_with_error_handling
    result = func()
File "C:\Users\siddh\python_envs\py310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 590, in code_to_exec
    exec(code, module. __dict__ )
File "C:\Users\siddh\OneDrive\Desktop\HR-Analytics---Project\model.py", line 163, in <module>
    main()
File "C:\Users\siddh\OneDrive\Desktop\HR-Analytics---Project\model.py", line 157, in main
    model = pickle.load(open('test.pkl','rb'))

```

A quick Google search this this as the first result: [module ‘xgboost.compat’ has no attribute ‘XGBoostLabelEncoder’ Error · Issue #6209 · dmlc/xgboost (github.com)](https://github.com/dmlc/xgboost/issues/6209)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [February 28, 2025, 7:48pm UTC](https://discuss.streamlit.io/t/getting-an-error-while-deploying-xgb-model/80172/7 "2025-02-28T19:48:17Z")

</div>

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