Why does Streamlit not find my python file?

Viewed 4769

I have Streamlit working in terminal i.e. the following runs in terminal:

$ streamlit hello

I am trying to create an app with the online tutorial but encounter an error - see below

https://docs.streamlit.io/en/latest/tutorial/create_a_data_explorer_app.html#let-s-put-it-all-together

I have saved the following in as uber_pickups.py

import streamlit as st
import pandas as pd
import numpy as np

st.title('Uber pickups in NYC')

(base) lf-mac-0250:~ alastairhayes$ streamlit hello

  You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL: http://172.20.10.2:8501

^C Stopping...

(base) lf-mac-0250:~ alastairhayes$ streamlit run uber_pickups.py
Usage: streamlit run [OPTIONS] TARGET [ARGS]...

Error: Invalid value: File does not exist: uber_pickups.py

Where am I going wrong? I have python 3.7.6 Many thanks!

1 Answers

If you're using Windows OS, you may try the steps below:

  1. First, you need to download Anaconda: https://www.anaconda.com/

  2. Open the Anaconda PowerShell Prompt and type the following:

    conda list

    pip uninstall streamlit

  3. Then, create a new environment, and test out the following:

    pip install streamlit

    streamlit hello

  4. Finally, you can test out streamlit on your code, replace your_app with the actual name of your file. Make sure you are in the same directory as your source code file.

    streamlit run your_app.py

Related