ModuleNotFoundError: No module named 'pymongo'


I am getting an error File “/app/firstapp/Src/”, line 3, in import pymongo when starting my app in Streamlit Cloud.

My Code -

import streamlit as st
from PIL import Image
import pymongo

client = pymongo.MongoClient(st.secrets["url"])

Requirements file content -

also tried with pymongo[tls,srv]==3.12.1 but no luck.

I am don’t know what I am missing here. Thanks in advance

Note: I am using the Community plan and the same code is working on my local machine


[client] Provisioning machine...

[client] Preparing system...

[manager] Starting up for owner: 'venkateshguptha', repository: 'firstapp', branch: 'main', main module: 'Src/'

[manager] Cloning repository ...

[manager] Cloning into 'firstapp'...

[manager] Cloned repository!

[manager] Processing dependencies ...

[manager] Processed dependencies!

[client] Spinning up manager process...

2021-10-21 17:54:43.360 Uncaught app exception

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.8/site-packages/streamlit/", line 354, in _run_script

    exec(code, module.__dict__)

  File "/app/firstapp/Src/", line 3, in <module>

    import pymongo

ModuleNotFoundError: No module named 'pymongo'

The main problem in my case is requirements were not processed. This is because my repo name had capital letters. When I change it to lower case, everything is working fine.

I literally spent a lot of time fixing this but finally, it is working.

1 Like