ModuleNotFoundError: No module named 'pymysql'

Hello, I am trying to deploy my app on streamlit.
I am using remote mysql.
On local Machine it works fine but when I try to deploy it I am getting this error:

2024-01-03 18:49:56.834 Uncaught app exception
Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/", line 534, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/cars-dashboard/", line 2, in <module>
    import pymysql
ModuleNotFoundError: No module named 'pymysql'
2024-01-03 18:49:57.039 503 GET /script-health-check ( 206.67ms

I tried to fix this for hours but for some reason I couldnt fix it.
I also read pretty similar topics about my issue but still I dont understand how to fix it,
Would be happy to get some assistance:) thanks!

this is the app I deploy earlier:

github link:

Hi @doravital4,

Thanks for posting!

So the issue seems to be stemming from the file encoding of your requirements.txt file being detected as UTF-16LE. This might explain the issue with installation of pymysql. The file should be in UTF-8 encoding. You can change this on your IDE by finding the option to change encoding to UTF-8, save the file, and commit the changes to your repo.

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