ModuleNotFoundError: No module named 'pymongo'

Hello,

I am getting an error File “/app/firstapp/Src/first.py”, 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 -
pymongo==3.12.1
streamlit==1.0.0
Pillow==8.4.0

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

logs

[client] Provisioning machine...

[client] Preparing system...

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

[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/script_runner.py", line 354, in _run_script

    exec(code, module.__dict__)

  File "/app/firstapp/Src/first.py", 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

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