ValueError: max() arg is an empty sequence

Hi everyone,

I was trying to do the tutorial on reinforcement learning but this error shows up when trying to plot the initial configuration of the PoleCart. After a bit research I think that the problem is with the backend of matplotlib. The tutorial says to set up matplotlib in this way:

set up matplotlib

is_ipython = ‘inline’ in matplotlib.get_backend()
if is_ipython:
from IPython import display

but the string that comes out of matplotlib.get_backend() for me is:

module://backend_interagg

Am I doing something wrong?

Are you using IPython (Jupyter notebooks or Google Colab)? If yes, one solution is setting %matplotlib inline which is a magic function. If you can share a link to the tutorial, I can check that out myself.

I’ve been using PyCharm, in a normal setting, so I’m guessing no IPython, also because I’ve tried to write the magic function and it gives me a syntax error.

https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html

This is the link to the tutorial :slight_smile:

Have you tried this?

How to prevent PyCharm from overriding default backend as set in matplotlib?

Oh I forgot to mention that I was connecting remotely to another computer and that was giving me problems! Now everything has worked out, since it’s just a tutorial I will run it locally. But now I will also try to run it remotely, even though it seems trivial: https://stackoverflow.com/questions/41892039/how-to-enable-x11-forwarding-in-pycharm-ssh-session

Thanks a lot for your help!