question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Images sometimes do not appear

See original GitHub issue

Summary

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:closed
  • Created 3 years ago
  • Reactions:10
  • Comments:50 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
kmcgradycommented, Oct 9, 2020

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.

3reactions
madpowahcommented, Jun 8, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve the "Images Not Showing on Website" Error [2022]
To resolve the images not showing problem, just close Chrome and open the Run prompt. Now, enter the '%localappdata%' command to go to...
Read more >
Why Are Web Page Images Not Showing? - Computer Hope
Possible causes · The web page is not pointing to the correct URL (location) of the image. · The server or computer hosting...
Read more >
7 Ways to Fix Google Chrome Not Loading Images - MakeUseOf
Is your browser unable to load images? This can be frustrating, but you can try out these various methods to fix the issue...
Read more >
Fix Windows 10 Picture Thumbnails Not Showing
8 different ways to fix photo thumbnails not appearing on Windows 10 PC manually. You can also try a reliable photo repair software...
Read more >
How Come Pictures Aren't Showing Up on Google?
But if you selected the "Strict" setting, sometimes no images may appear. To fix this, open Google and click "Images" below the Search...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found