I’m encountering a deployment error when trying to load a machine learning model on Streamlit Community Cloud. The app works perfectly fine in my local environment, but fails on Community Cloud with the following error:
Error Message:
Failed to load model: STACK_GLOBAL requires str
Deployed App: https://loan-prediction-e2e-ml-workflow-ard6bwrixhzcoa4ffwlazw.streamlit.app/
GitHub Repository: GitHub - Hsotuhsa-S/Loan-Prediction-E2E-ML-Workflow
The repository includes a requirements.txt file with all necessary dependencies.
Context:
-
The app works without any issues in the local environment
-
The error occurs specifically when loading the ML model on Community Cloud
-
Python version and other details are available in the attached app log
See App deployment log file (contains Python version and detailed error trace):
[ UTC ] Logs for loan-prediction-e2e-ml-workflow-ard6bwrixhzcoa4ffwlazw.streamlit.app/
────────────────────────────────────────────────────────────────────────────────────────
[18:51:39]
Starting up repository: ‘loan-prediction-e2e-ml-workflow’, branch: ‘main’, main module: ‘LoanData_App_Model_Deployment.py’
[18:51:39]
Cloning repository…
[18:51:45]
Cloning into ‘/mount/src/loan-prediction-e2e-ml-workflow’…
Updating files: 100% (23/23)
Updating files: 100% (23/23), done.
[18:51:45]
Cloned repository!
[18:51:45]
Pulling code changes from Github…
[18:51:46]
Processing dependencies…
──────────────────────────────────────── uv ───────────────────────────────────────────
Using uv pip install.
Using Python 3.13.7 environment at /home/adminuser/venv
Resolved 131 packages in 709ms
Prepared 131 packages in 3.58s
Installed 131 packages in 481ms
- altair==5.5.0
- anyio==4.11.0
- argon2-cffi==25.1.0
- argon2-cffi-bindings==25.1.0
- arrow==1.3.0
- asttokens==3.0.0[2025-10-04 18:51:51.671339]
- async-lru==2.0.5
- attrs==25.3.0
- babel==2.17.0
- beautifulsoup4==4.14.2
- bleach==6.2.0
- blinker==1.9.0
- cachetools==6.2.0
- certifi==2025.8.3
- cffi==2.0.0
- charset-normalizer==3.4.3
- click[2025-10-04 18:51:51.671641] ==8.3.0
- comm==0.2.3
- contourpy==1.3.3
- cycler==0.12.1
- debugpy==1.8.17
- decorator==5.2.1
- defusedxml==0.7.1
- executing==2.2.1
- fastjsonschema==2.21.2
- fonttools==[2025-10-04 18:51:51.671860] 4.60.1
- fqdn==1.5.1
- gitdb==4.0.12
- gitpython==3.1.45
- h11==0.16.0
- httpcore==1.0.9
- httpx==0.28.1
+[2025-10-04 18:51:51.672095] idna==3.10 - ipykernel==6.30.1
- ipython==9.6.0
- ipython-pygments-lexers==1.1.1
- ipywidgets==8.1.7
- isoduration==20.11.0
- jedi==0.19.2
[2025-10-04 18:51:51.672511] + jinja2==3.1.6 - joblib==1.5.2
- json5==0.12.1
- jsonpointer==3.0.0
- jsonschema==4.25.1
- jsonschema-specifications==2025.9.1
- jupyter==1.1.1
- jupyter-client==8.6.3[2025-10-04 18:51:51.672777]
- jupyter-console==6.6.3
- jupyter-core==5.8.1
- jupyter-events==0.12.0
- jupyter-lsp==2.3.0
- jupyter-server==2.17.0
- jupyter-server-terminals==0.5.3
- jupyterlab==4.4.9[2025-10-04 18:51:51.673026]
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.3
- jupyterlab-widgets==3.0.15
- kiwisolver==1.4.9
- lark==1.3.0
- markupsafe==3.0.3
- matplotlib==3.10.6[2025-10-04 18:51:51.673384]
- matplotlib-inline==0.1.7
- mistune==3.1.4
- narwhals==2.6.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- [2025-10-04 18:51:51.673576] nest-asyncio==1.6.0
- notebook==7.4.7
- notebook-shim==0.2.4
- numpy==2.3.3
- packaging==25.0
- pandas==2.3.3
- pandocfilters==1.5.1
[2025-10-04 18:51:51.673684] + parso==0.8.5 - patsy==1.0.1
- pexpect==4.9.0
- pillow==11.3.0
- platformdirs==4.4.0
- prometheus-client==0.23.1
- prompt-toolkit==3.0.52
- protobuf[2025-10-04 18:51:51.673796] ==6.32.1
- psutil==7.1.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pyarrow==21.0.0
- pycparser==2.23
- pydeck==0.9.1
- pygments==2.19.2
- pyparsing[2025-10-04 18:51:51.673913] ==3.2.5
- python-dateutil==2.9.0.post0
- python-json-logger==3.3.0
- pytz==2025.2
- pyyaml==6.0.3
- pyzmq==27.1.0
- referencing==0.36.2[2025-10-04 18:51:51.674008]
- requests==2.32.5
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rfc3987-syntax==1.1.0
- rpds-py==0.27.1
- scikit-learn==1.7.2
- scipy==1.16.2
- seaborn==0.13.2[2025-10-04 18:51:51.674122]
- send2trash==1.8.3
- setuptools==80.9.0
- six==1.17.0
- smmap==5.0.2
- sniffio==1.3.1
- soupsieve==2.8
- stack-data==[2025-10-04 18:51:51.674226] 0.6.3
- statsmodels==0.14.5
- streamlit==1.50.0
- tenacity==9.1.2
- terminado==0.18.1
- threadpoolctl==3.6.0
- tinycss2==1.4.0
- toml==0.10.2
+[2025-10-04 18:51:51.674337] tornado==6.5.2 - traitlets==5.14.3
- types-python-dateutil==2.9.0.20250822
- typing-extensions==4.15.0
- tzdata==2025.2
- uri-template==1.3.0
- urllib3==2.5.0
[2025-10-04 18:51:51.674487] + watchdog==6.0.0 - wcwidth==0.2.14
- webcolors==24.11.1
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==4.0.14
Checking if Streamlit is installed
Found Streamlit version 1.50.0 in the environment
Installing rich for an improved exception logging
Using uv pip install.
Using Python 3.13.7 environment at /home/adminuser/venv
Resolved 4 packages in 126ms
Prepared 3 packages in 40ms
Installed 3 packages in 7ms - markdown-it-py==4.0.0
- mdurl==0.1.2
- rich==14.1.0[2025-10-04 18:51:53.072851]
────────────────────────────────────────────────────────────────────────────────────────
[18:51:53]
Python dependencies were installed from /mount/src/loan-prediction-e2e-ml-workflow/requirements.txt using uv.
Check if streamlit is installed
Streamlit is already installed
[18:51:54]
Processed dependencies!
/home/adminuser/venv/lib/python3.13/site-packages/sklearn/base.py:442: InconsistentVersionWarning: Trying to unpickle estimator OneHotEncoder from version 1.6.1 when using version 1.7.2. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:
warnings.warn(
/home/adminuser/venv/lib/python3.13/site-packages/sklearn/base.py:442: InconsistentVersionWarning: Trying to unpickle estimator Pipeline from version 1.6.1 when using version 1.7.2. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:
warnings.warn(
[19:08:25]
Disconnecting…
[19:08:30]
Provisioning machine…
[19:08:35]
Preparing system…
[19:08:42]
Spinning up manager process…
[19:08:47]
Inflating balloons…
[19:08:28]
Starting up repository: ‘loan-prediction-e2e-ml-workflow’, branch: ‘main’, main module: ‘LoanData_App_Model_Deployment.py’
[19:08:28]
Cloning repository…
[19:08:33]
Cloning into ‘/mount/src/loan-prediction-e2e-ml-workflow’…
Updating files: 100% (23/23)
Updating files: 100% (23/23), done.
Has anyone encountered this “STACK_GLOBAL requires str” error before? Any suggestions on how to resolve this model loading issue would be greatly appreciated!
Thank you!