Got error when delpoying my app :ModuleNotFoundError: No module named 'plotly'

I am trying to delpoy this app:https://share.streamlit.io/purplegrace/engineering_sd_housing_analysis/main/SDRE_streamlit.py
But got error like the below. Any one can help? Thank you!

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/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 430, in _run_script
    exec(code, module.__dict__)File "/app/engineering_sd_housing_analysis/SDRE_streamlit.py", line 4, in <module>
    import plotly.express as px

Hey @PurpleGrace

Welcome to the Streamlit Community :tada::tada:.

You have to create a file specifying the libraries that your app needs to run on the cloud. Right now I didn’t find any such file on your repo. The easiest way of doing so is by creating a requirements.txt file and listing the names of all required libraries (with specific versions if not the latest one).
There are other methods too and all of them are listed here - App dependencies - Streamlit Docs.

Hope this helps
Kanak

1 Like

hi Kanak,
thannks so much for your help. I found I put requirements.text in wrong place. The previous error is solved, but I got a new error.
Could you please help take a look?

  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      /bin/sh: 1: mysql_config: not found
      /bin/sh: 1: mariadb_config: not found
      /bin/sh: 1: mysql_config: not found
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/var/tmp/pip-install-aqxjuiy6/mysqlclient_cde80f8529ec4b8cb030af42a87df046/setup.py", line 15, in <module>
          metadata, options = get_config()
        File "/var/tmp/pip-install-aqxjuiy6/mysqlclient_cde80f8529ec4b8cb030af42a87df046/setup_posix.py", line 70, in get_config
          libs = mysql_config("libs")
        File "/var/tmp/pip-install-aqxjuiy6/mysqlclient_cde80f8529ec4b8cb030af42a87df046/setup_posix.py", line 31, in mysql_config
          raise OSError("{} not found".format(_mysql_config_path))
      OSError: mysql_config not found
      mysql_config --version
      mariadb_config --version
      mysql_config --libs
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Hey @PurpleGrace

Your app seems to be missing out on credentials required to connect to the database.

Can you follow this tutorial (Connect Streamlit to MySQL - Streamlit Docs) to connect to the MySQL database?

Best,
Kanak

1 Like

Hi Kanak,
Thanks a lot for your help

I added secrets.toml and copied it to the cloud as the link you provide, but I still got the same eroor :rofl:

I really have no idea about it.
Can you create a new post about it? Since this one has been marked solved, there are fewer chances of other people opening it.