1

When I try to use certain functions from matplotlib, my code gets stuck at those functions. For example, if I try to run

import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()

x = np.random.randint(0, 10, 10)
y = np.random.randint(0, 10, 10)

plt.plot(x, y)
plt.show()

It succesfully runs plt.figure(), but the execution of the code gets stuck at plt.plot(x, y). No error codes are produced, and I can't interrupt execution using ctrl+c.

I work on Linux Mint 5.4.0-70-generic and I use miniconda for my python installation. I have python3.9 installed with the newest matplotlib and numpy packages. I already completely re-installed conda and python using tsveti_iko's answer (my previous version was python3.8, which gave the exact same issue). Up until today, everything worked perfectly.

EDIT: The only thing that I did before it stopped working is that I updated my os using apt-get update & apt-get upgrade. But I don't know if this could cause my above issue.

If I use

import logging
logging.basicConfig(level=logging.DEBUG)

I get the following output:

DEBUG:matplotlib:matplotlib data path: 
/home/sjoerd/miniconda3/lib/python3.9/site-packages/matplotlib/mpl-data
DEBUG:matplotlib:CONFIGDIR=/home/sjoerd/.config/matplotlib
DEBUG:matplotlib:matplotlib version 3.4.3
DEBUG:matplotlib:interactive is False
DEBUG:matplotlib:platform is linux
DEBUG:matplotlib:loaded modules: [(whole list of modules loaded, not shown here)]
DEBUG:matplotlib:CACHEDIR=/home/sjoerd/.cache/matplotlib
DEBUG:matplotlib.font_manager:Using fontManager instance from /home/sjoerd/.cache/matplotlib/fontlist-v330.json
DEBUG:matplotlib.pyplot:Loaded backend qt5agg version unknown.
DEBUG:matplotlib.pyplot:Loaded backend Qt5Agg version unknown.
  • What IDE/program are you using? This is purely anecdotal but I had something similar happen a while ago with PyCharm and the PyQt5 plugin. Unfortunately i don't remember what the magic bullet was but if no one has a better idea then maybe check that out – havingaball Nov 17 '21 at 22:30
  • @havingaball I just use atom as my text editor, and execute my code in the terminal. – sjoerdgitaar Nov 18 '21 at 07:35
  • @john-hen, it is indeed really the plot call that hangs. I added the output of logging to the question. – sjoerdgitaar Nov 18 '21 at 07:39

1 Answers1

1

This was indeed a very specific problem. For my work I needed to install the citrix workspace. Somehow this interfered with matplotlib. Uninstalling the citrix client completely solved the problem.

  • Have you reported this as a bug at matplotlib? If not, please do so. They are able to help you out further and in the process gain knowledge for bugfixes. End of Review. – ZF007 Nov 19 '21 at 09:55