How to Install Streamlit on CentOS

Streamlit is an open source Python library. This utility is designed to create custom web applications for machine learning and data analysis. It is one of the fastest ways to design, build, and deploy data processing applications.

Installing and Configuring Prerequisites

An important component in installing Streamlit is the availability and latest updates to Python. You need to install the required dependencies to compile the Python source code. You can do it like this:

yum groupinstall 'development tools' -y && yum install wget openssl-devel bzip2-devel libffi-devel xz-devel -y

The current version for this moment is Python 3.9.6. Using wget, install this:

wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz

Next – unarchive

tar xzf Python-3.9.6.tgz

Then compiling the code with cd

cd Python-3.9.6 && ./configure --enable-optimizations

Then the Python installation itself. Once again, we draw your attention to the relevance of Python 3.9.6

make altinstall

Set Python 3.9.6 as the default version using the command below:

alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 1 && alternatives --set python3 /usr/local/bin/python3.9 && echo "2" | alternatives --config python

Update your pip. Location -> /usr/local/bin/python3.9

# /usr/local/bin/python3.9 -m pip install --upgrade pip

Then, after checking your Python version (# python –version && pip –version), you can go to your cd root directory

Installing Streamlit

Install your Streamlit using pip. The pip update has already been configured before, and now everything is ready for installation:

pip install streamlit

After successfully installing Streamlit, you need to run it on your operating system. In this article, we are talking about Debian. It is possible to run Streamlit through your HTTPS. To deploy a web application to an HTTP port, first allow the http port on the firewall. As a reminder, http – port is 80, by default:

firewall-cmd --permanent --add-service=http

Then, after successful actions, you need to reboot your firewall. This can be done with the following program:

firewall-cmd --reload

Then start your Streamlit using the following command:

streamlit run main.py --server.port 80

Was this article helpful?

Related Articles

Leave A Comment?