App fine locally, but tracebacks when deployed

Hello! I’ve written a .py script to scrape basketball statistics and display a dataframe. Name of the .py file is ucsb_streamlit.py, and it runs fine locally when I run:

streamlit run ucsb_streamlit.py

The dataframe shows up perfectly on the webpage. However when I deploy the app, I get hit with the traceback(s) in the attached photo.


It seems to be pointing to the following simple line of the code:

df = pd.read_html(url)

Why would that cause a traceback? Also in re: to the last bit of the error, I have verified that I already have lxml installed on my machine by running

pip install lxml

I get back “Requirement already satisfied…” Any help is much appreciated, thank you!

Update:

I learned about the requirements.txt necessity. So I added that for the few things I’m using:

lxml==4.6.3
pandas==1.3.4
streamlit==1.8.1

But now I get a long error running the app. From googling around, seems a lot of folks are having this problem. I can’t understand what I need to do. Thanks to anyone who can help! (error msg is attached in photo)

Take a look at the dependencies of the packages you are utilizing, maybe try to let the requirements free rather than stating the version, and go in order streamlit, pandas and then lxml. If possible, please share the repo.

Your idea of stating the requirements in order worked! Simply changed the requirements to:

streamlit==1.8.1
pandas==1.3.4
lxml==4.6.3

Thanks so much!

1 Like

Glad you got it sorted out! I suspect that the ordering might have been luck; if you set streamlit >= 1.9.2, it will fix it for certain (irrespective of the order)

Best,
Randy