Streamlit provides an easy and rapid way to turn data scripts into interactive web apps. However, at times, developers may need to ensure that their Streamlit applications run offline. Here’s a simple guide to setting up Streamlit in an offline environment using Anaconda and Visual Studio Code (VSCode).
Follow these steps to set up Streamlit within an Anaconda environment:
Install Anaconda & VSCode
Create a Python Conda Environment
conda create --name bds-streamlit python==3.11.4
Activate the Environment
conda activate bds-streamlit
Install pipreqs
requirements.txt
file.pip install pipreqs
Generate requirements.txt
pipreqs
Install the Necessary Packages
pip install -r requirements.txt
If you’d rather not use a specific environment:
Install Anaconda & VSCode (as mentioned above).
Install the Required Packages Directly
pip install pandas streamlit matplotlib altair seaborn
Navigate to Your Project Directory
cd path/to/your/app_directory
Run the App
streamlit run app.py
python -m streamlit run app.py
With these steps, you’re all set to develop and run your Streamlit apps offline! Whether you’re using an Anaconda environment or not, the process is straightforward and ensures you have all the necessary dependencies installed.