Spyder is restarting kernel without error message
Question:
Trying to run this example script in spyder IDE version 5.1.5
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.gridspec as gridspec
# Fixing random state for reproducibility
np.random.seed(19680801)
dt = 0.01
t = np.arange(0, 10, dt)
nse = np.random.randn(len(t))
r = np.exp(-t / 0.05)
cnse = np.convolve(nse, r) * dt
cnse = cnse[:len(t)]
s = 0.1 * np.sin(2 * np.pi * t) + cnse
fig, (ax0, ax1) = plt.subplots(2, 1)
ax0.plot(t, s)
ax1.psd(s, 512, 1 / dt)
plt.show()
leads to
Restarting kernel...
without any further error message. Python version is 3.8.12, intalled with Anaconda.
Answers:
Thank you Daniel Althviz for the hint.
This solution solved the problem:
conda install freetype=2.10.4
Probably a mismatch between matplotlib
and spyder
versions. Using conda
, uninstall both then install first spyder
and then matplotlib
. If using pip
check the matplotlib
version in the spyder
documentation.
Trying to run this example script in spyder IDE version 5.1.5
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.gridspec as gridspec
# Fixing random state for reproducibility
np.random.seed(19680801)
dt = 0.01
t = np.arange(0, 10, dt)
nse = np.random.randn(len(t))
r = np.exp(-t / 0.05)
cnse = np.convolve(nse, r) * dt
cnse = cnse[:len(t)]
s = 0.1 * np.sin(2 * np.pi * t) + cnse
fig, (ax0, ax1) = plt.subplots(2, 1)
ax0.plot(t, s)
ax1.psd(s, 512, 1 / dt)
plt.show()
leads to
Restarting kernel...
without any further error message. Python version is 3.8.12, intalled with Anaconda.
Thank you Daniel Althviz for the hint.
This solution solved the problem:
conda install freetype=2.10.4
Probably a mismatch between matplotlib
and spyder
versions. Using conda
, uninstall both then install first spyder
and then matplotlib
. If using pip
check the matplotlib
version in the spyder
documentation.