Images sometimes do not appear
See original GitHub issueSummary
The site randomly shows “0” for images inserted via st.image() and MediaFileManager logs “Missing file”.
More information
I have a couple of jpg images embedded with st.image() and randomly they will not render, instead there will just be a 0 shown instead. Reloading the page or rerunning the code fixes the problem. When I reload the page often enough one ore several of the images will break again and just show a 0.
In the terminal with --log_level error I receive
MediaFileManager: Missing file d8a7ff62725a8ab1609c9335ba2e85375f491027d91b3badb27a6ccd
In my complex multi-page streamlit app this happens very often, if I reload the page two or three times, one out of five images is likely broken. The simpler toy example below takes much longer to show the undesired behaviour, but it does so fairly consistently.
Steps to reproduce
Run this code (ideally with --log_level error):
import streamlit as st
if st.checkbox('checkbox'):
st.image("foo.jpg")
Toggle that checkbox repeatedly (this method is quicker than reloading the page) and look at the console output. Maybe rerun the code once in a while. (Of course you need to put any jpg image named “foo.jpg” in the same folder).
Actual behaviour
Sooner or later (5-50 clicks) the image will not be shown. Instead, in its place a 0 appears. A “MediaFileManager: Missing file” error is shown in the terminal.
Expected behaviour
Images should always be shown.
Debug info
- Streamlit version: 0.57.1
- Python version: 3.6.9
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:50 (7 by maintainers)
Top GitHub Comments
We’ve QAed a lot of scenarios and feel comfortable that the change is an improvement. The change has been merged, and it will be in the next release.
Same issue on my side with the version 0.61. It happens when displaying 2 pie chart created by the same function called twice. The first st.pyplot is not displayed.
Edit : adding a sleep(0.2) after the pyplot() seems work as workaround