Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Streamlit not find my python file?

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!

like image 829
Alastair Hayes Avatar asked Mar 05 '26 14:03

Alastair Hayes


1 Answers

The error message indicates that the file does not exist, which suggests that either the file is not saved in the correct location or the file name is misspelled.

A few things you can try to resolve the issue:

  • Make sure that the uber_pickups.py file is saved in the same directory where you are running the streamlit run command as someone already mentioned above. You can use the cd command to navigate to the correct directory before running the streamlit run uber_pickups.py command.

  • Double-check the spelling of the file name to make sure it matches exactly, including capitalization.

  • Try specifying the full path to the uber_pickups.py file in the streamlit run command. For example, if the file is saved in the /Users/alastairhayes/Documents/Streamlit directory, you can run the command as follows:

    streamlit run /Users/alastairhayes/Documents/Streamlit/uber_pickups.py

I hope one of these solutions helps.

like image 60
Tony Kipkemboi Avatar answered Mar 07 '26 04:03

Tony Kipkemboi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!