-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
type:bugSomething isn't working as expectedSomething isn't working as expected
Description
Summary
I'm using matplotlib with a few sliders to plot some data. But after having changed the sliders some times streamlit crashes with the a RuntimeError
I've experienced this in other applications as well.
Steps to reproduce
Run the below code and change the sliders until Streamlit crashes with a RuntimeError
import streamlit as st
import numpy as np
from scipy.stats import norm
import pandas as pd
import matplotlib.pyplot as plt
def write():
plot_section()
def plot_section():
st.markdown(
"""
## Interactive plot - Streamlit
"""
)
x = get_x()
mu = st.slider(
"mu", value=float(0), min_value=float(-5), max_value=float(5), step=float(0.1)
)
sigma = st.slider(
"sigma",
value=float(1),
min_value=float(0.1),
max_value=float(5),
step=float(0.1),
)
plot_figure(x, mu, sigma)
@st.cache
def get_x():
return np.linspace(-10, 10, 200)
def plot_figure(x, mu: float = 0, sigma: float = 1):
y = norm.pdf(x, mu, sigma)
title = f"Gaussian Density (mu = {mu} and sigma = {sigma})"
plt.hist(y, bins=20)
st.pyplot()
write()Expected behavior:
No Error
Actual behavior:
Streamlit crashes with this Error
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Image.__del__ at 0x000000384A5821E0>
Traceback (most recent call last):
File "C:\Users\masma\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3507, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Tcl_AsyncDelete: async handler deleted by the wrong threadIs this a regression?
no
Debug info
- Streamlit version: 0.47.4
- Python version: 3.7.2
- Not using Conda, PipEnv, PyEnv or Pex. I'm just using
python -m venv .venv - OS version: Windows 8.1
- Browser version: Chrome
- Matplotlib. 3.1.1
bluesheeptoken and kurzacz
Metadata
Metadata
Assignees
Labels
type:bugSomething isn't working as expectedSomething isn't working as expected
