Streamlit cloud face issue in mysqlclient installing

Hi @Kalim_Amzad, welcome to the community! :wave: :partying_face:

To connect to a remote MySQL database from Streamlit Cloud, we recommend using the mysql-connector-python library instead, as demonstrated in this tutorial:

You will be unable to host a MySQL server on Streamlit Cloud and connect to it using mysqlclient.

However, if you insist on installing mysqlclient, there are additional steps required for a successful installation. The official Linux installation instructions state that the following Linux packages need to be installed first:

python3-dev, default-libmysqlclient-dev, and build-essential.

As these are apt-get depedencies, you will need to create a packages.txt file containing the following:

python3-dev
default-libmysqlclient-dev
build-essential

Next, add the following Python dependency to your requirements.txt:

mysqlclient

You will then be able to import MySQLdb in your app.

Best, :balloon:
Snehan

2 Likes