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.

Asked By: beenieman

||

Answers:

Thank you Daniel Althviz for the hint.

This solution solved the problem:

conda install freetype=2.10.4

Ref: spyder-ide GitHub issue 16659

Answered By: beenieman

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.

Answered By: Marlon Teixeira
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.