ModuleNotFoundError: pymongo, works locally, but not on Streamlit Cloud

My project uses pymongo, which is also specified in the requirements.txt. It works locally. But on Streamlit Cloud, I get an error message. What did I miss here? I’d appreciate any tips.

Link to the public app: https://judgegpt.streamlit.app/
Link to your app’s public GitHub repository (including a requirements file): GitHub - aloth/judgegpt: JudgeGPT - (Fake) News Evaluation, a research project

Full text of the error message:

ModuleNotFoundError: 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:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)File "/mount/src/judgegpt/app.py", line 7, in <module>
    from pymongo.server_api import ServerApi

Streamlit and Python versions:

streamlit==1.31.1
python==3.11

Hi @xlth

There’s a tutorial on connecting your Streamlit app to MongoDB and Community Cloud, that you could try: