How to Install Streamlit on Linux

Streamlit is a Python library that web developers use to develop web applications. Its working principle is based on three simple components. The first is to build the simple Python code into the API. The second is to add different widgets without needing a backend, CSS, or HTML script. The last is to deploy the created application and share without paying a single penny. 

To install this remarkable Python library known as “Streamlit” on Linux, different methods are explained in this post. 

How to Install Streamlit on Linux?

To install the Streamline on different Linux distributions, the following methods can be used:

  1. Using Pip
  2. Using Conda
  3. Using the Source Package

Method 1: Install Streamlit Using the Pip

Pip is the package manager for the Python packages and can be used for the installation of Streamlit, follow the below-mentioned steps. 

Step 1: Launch the Terminal

To run the commands for the installation of Streamlitm first launch the terminal of the Linux distribution:

How to Install Streamlit on Linux 1

Step 2: Update the Packages

It is recommended users update the packages of the Linux distribution when they boot them for the first time with the following command.

Update the Debian-based Linux distributions:

$ sudo apt update
How to Install Streamlit on Linux 2

Update the Fedora-based Linux distributions:

$ sudo dnf update

Update the CentOS-based Linux distributions:

$ sudo yum update

Update the Arch-based Linux distributions:

$ sudo pacman -Syu

When the packages of the Linux distribution are up to date, then proceed towards the installation of the Pip package. 

Step 3: Install the Pip Package

To install the Pip package manager, use the command according to the installed Linux distribution.

Install Pip on Debian-based Linux distributions

$ sudo apt install python3-pip -y
How to Install Streamlit on Linux 3

Install Pip on Fedora-based Linux distribution

$ sudo dnf install python3-pip

Install Pip on CentOS-based Linux distribution

$ sudo yum install epel-release && sudo yum install python3-pip

Installation of the  Pip  Package on Arch-based Linux distribution

$ sudo pacman -S python-pip

Step 4: Verify the Installation of Pip Package

To verify the installation of the Pip package, display the installed version of the Pip with the command:

$ pip --version
How to Install Streamlit on Linux 4

Step 5: Install Streamlit 

Now use the installed pip package for the installation of the Streamlit:

$ pip install streamlit --break-system-packages
How to Install Streamlit on Linux 5

Step 6: Upgrade the Streamlit 

To upgrade the streamlit to its updated version using the pip package, run the command:

$ pip install --upgrade streamlit --break-system-packages
How to Install Streamlit on Linux 6

How to Uninstall Streamlit on Linux Using the Pip Package?

To uninstall Streamlit on Linux using the pip package manager, use the command:

$ pip uninstall streamlit --break-system-packages
How to Install Streamlit on Linux 7

Method 2: Install Streamlit Using the Conda

Another environment or the package management tool that is used on Windows and Linux for the management of packages is known as Conda. Conda can be used for the installation of Streamlit on different Linux distributions by the below-mentioned instructions. 

Step 1: Install Miniconda

First install the Miniconda with the following commands according to the installed Linux distribution. 

Install Miniconda on Debian-based Linux distributions:

First download the installer of the Miniconda using the wget command:

$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
How to Install Streamlit on Linux 8

Then run the downloaded installer of the Miniconda:

$ bash miniconda.sh -b -p $HOME/miniconda
How to Install Streamlit on Linux 9

Now add it to the $PATH variable:

$ echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> ~/.bashrc
How to Install Streamlit on Linux 10

Finally reload the $PATH variable:

$ source ~/.bashrc
How to Install Streamlit on Linux 11

Install Miniconda on Fedora-based and CentOS-based Linux Distributions

The same installation approach is used for Miniconda on Fedora-based and CentOS-based Linux distributions that is for the Debian-based distribution. 

Install Miniconda on Arch-based Linux Distribution

In the bash desktop environment, run the following command for installing the Miniconda on Arch-based Linux distribution:

$ yay -S miniconda3

Step 2: Setting up the Conda

Use the installed Python version for setting up the Conda on Linux distribution:

$ conda create -n streamlit-Env python=3.11
How to Install Streamlit on Linux 12

Step 3: Activate the Conda

Activate the conda environment that is created in the previous step:

$ conda activate streamlit-Env
How to Install Streamlit on Linux 14

Step 4: Install the Streamlit

For installing the Streamlit, run the command:

$ conda install -c conda-forge streamlit
How to Install Streamlit on Linux 15

Step 5: Deactivating the Conda Environement

After the installation is completed, deactivate the Conda environment:

$ conda deactivate
How to Install Streamlit on Linux 17

Step 6: List Down all the Conda Environments

To list down all the Conda environment, execute the command:

$ conda env list
How to Install Streamlit on Linux 18

How to Uninstall the Streamlit Using the Conda Environment?

To uninstall Streamlit using the Conda, simply remove the created Conda environment in which Streamlit has been installed:

$ conda env remove -n streamlit-Env
How to Install Streamlit on Linux 19

Method 3: Install Streamlit Using the Source Package

For installing the Streamlit from the source package, we will use the git package by the explained steps.

Step 1: Install Git 

First install the Git package according to the installed Linux distribution on your machine. 

Installation of the Git Package on Debian-based Linux distribution:

$ sudo apt install git -y
How to Install Streamlit on Linux 20

Installation of the Git Package on Fedora-based Linux distribution

$ sudo dnf install git

Installation of the Git Package on CentOS-based Linux distribution

$ sudo yum install git

Install Git on Arch-based Linux distribution

$ sudo pacman -S git

Step 2: Clone the Repository of Streamlit

Now uses the git package for cloning the repository of Streamlit:

$ git clone https://github.com/streamlit/streamlit.git
How to Install Streamlit on Linux 21

Step 3: Navigate to the Streamlit

After cloning the Streamlit repository, navigate to it with the cd command:

$ cd streamlit/lib/
How to Install Streamlit on Linux 22

Step 4: Install Streamlit

Use the installed Python package for the installation of the Streamlit:

$ python3 setup.py install
How to Install Streamlit on Linux 23

The package of the Streamlit has been installed successfully on the Linux distribution. 

Conclusion

To install the Streamlit on Linux, three different methods can be used. The first is by using the pip, the second is with the conda, and the last is by using the source. This post has explained all these methods for installing Streamlit on different Linux distributions in detail. Streamlit has been used for development of web applications quickly on Linux.