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.

MediaFileManager: Missing file on Google App Engine

See original GitHub issue

Hi All 🙂,

I have been going through the process of deploying a Streamlit application to https://radiotherapy.ai using Google App Engine. Once it was deployed it presented an interesting bug that I hadn’t seen before. The matplotlib plots were intermittently not showing up within the interface and the following error message was presented within the App Engine logs:

2021-05-26 05:10:15 default[20210526t145605]  2021-05-26 05:10:15.441 MediaFileManager: Missing file 5c5c1707408633221e9aab6c4c4f9437cdab6da0ed660ef129103e79.png

Here is what I saw

image


Here is what was able to make the app able to see if I dragged the slider to other values and then came back a few times:

image


I had a suspicion that this might be due to the new garbage collection process being undergone in 0.82.0:

https://github.com/streamlit/streamlit/blob/7ebd8bf4e54f88e37408d87080cbca521f2587e7/docs/changelog.md#L19-L25

So I downgraded to version 0.81.1, but unfortunately the issue was still present.

Then, wondering if maybe I wasn’t provisioning sufficient RAM I increased the instance from 5 GB up to 16 GB. However unfortunately this still didn’t rectify the issue.

I haven’t yet pointed my domain to the app engine version, so if you’d like to see this issue in action go to https://rtai-autocontouring.ts.r.appspot.com/.


I’d be more than happy to go through further debugging if you so desire.


I have copied in the code I am using to produce this below, of particular note, I am directly passing the fig object through to st.pyplot, so hopefully shouldn’t be running into the issue of using the global plt.figure() object.

# main.py

fig = _utilities.comparison_display(
    x, y, ct_image, gold_standard_masks, predicted_masks, zoom, windowing
)
st.pyplot(fig)
# _utilities.py

def comparison_display(
    x,
    y,
    ct_image,
    ground_truth_masks,
    predicted_masks=None,
    zoom=1,
    windowing=(None, None),
    figsize=(8, 6),
):
    fig, axs = plt.subplots(nrows=1, ncols=2, figsize=figsize)

    c = _individual_plots(
        axs[0], x, y, ct_image, ground_truth_masks, zoom=zoom, windowing=windowing
    )
    axs[0].set_title("Ground Truth")
    if not predicted_masks is None:
        _individual_plots(
            axs[1], x, y, ct_image, predicted_masks, zoom=zoom, windowing=windowing
        )
        axs[1].set_title("Model")

    label_to_handle_map = {}
    for ax in axs:
        handles, labels = ax.get_legend_handles_labels()
        for handle, label in zip(handles, labels):
            if not label in label_to_handle_map.keys():
                label_to_handle_map[label] = handle

    fig.colorbar(c, ax=axs[:], shrink=0.8, location="bottom")
    labels = list(label_to_handle_map.keys())
    handles = [label_to_handle_map[label] for label in labels]

    if len(labels) != 0:
        fig.legend(
            handles=handles,
            labels=labels,
            loc="upper center",
            bbox_to_anchor=(0.5, 1.05),
            ncol=len(labels),
        )

    return fig

Cheers 🙂, Simon

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
charlielitocommented, Jan 20, 2022

I was having the same problem but for visualizing videos in a streamlit app but deployed to Google Cloud Run. I manage to get it working by setting Maximum requests per container to a high value (100) and #CPU=1

0reactions
kmcgradycommented, Jul 7, 2021

Thanks @SimonBiggs! Really appreciate your help here!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google App Engine deployment: missing file - Stack Overflow
I have a problem with google app engine. It used to work but now I can't figure out whats wrong... python: can't open...
Read more >
App in Streamlit Cloud not running in the same way as on ...
I managed , for most part, deployed my app to Streamlit cloud and ended ... same issue: MediaFileManager: Missing file on Google App...
Read more >
Google App Engine Missing subfolders in downloaded Source ...
I was able to use Container Registry > Build History to generate the source code of an application (including folders).
Read more >
Media File Manager - Apps on Google Play
Media Manager provides access to pictures, music, video, documents, and other files on both your Android devices and your computers. Features List:
Read more >
Specifying Dependencies - App Engine - Google Cloud
To ensure that your app uses module-aware mode, do the following in your development environment: Create your module's go.mod file in the same...
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