kengz/openai_lab

matplotlib backend

enzoMiller opened this issue · 3 comments

when I run "python3 main.py -e dqn_epsilon" I can see the animation but I don't get the graphs. I get the following error :

[2017-04-06 19:52:04,209] ERROR: Error in trial, terminating further session from dqn_epsilon-2017_04_06_195200_t0_s0
Traceback (most recent call last):
File "/Users/enzo/Desktop/openai_lab-master/rl/experiment.py", line 262, in run
self.run_episode()
File "/Users/enzo/Desktop/openai_lab-master/rl/experiment.py", line 243, in run_episode
self.update_history()
File "/Users/enzo/Desktop/openai_lab-master/rl/experiment.py", line 210, in update_history
self.grapher.plot()
File "/Users/enzo/Desktop/openai_lab-master/rl/analytics.py", line 119, in plot
p1.set_ydata(sys_vars['total_rewards_history'])
File "/usr/local/lib/python3.5/site-packages/matplotlib/lines.py", line 1251, in set_ydata
self.stale = True
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 279, in stale
self.stale_callback(self, val)
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 76, in _stale_axes_callback
self.axes.stale = val
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 279, in stale
self.stale_callback(self, val)
File "/usr/local/lib/python3.5/site-packages/matplotlib/figure.py", line 56, in _stale_figure_callback
self.figure.stale = val
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 279, in stale
self.stale_callback(self, val)
File "/usr/local/lib/python3.5/site-packages/matplotlib/pyplot.py", line 576, in _auto_draw_if_interactive
fig.canvas.draw_idle()
File "/usr/local/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 2032, in draw_idle
self.draw(*args, **kwargs)
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py", line 77, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 1706, in _idle_draw_cntx
yield
File "/usr/local/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 2032, in draw_idle
self.draw(*args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py", line 464, in draw
self.figure.draw(self.renderer)
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/matplotlib/figure.py", line 1143, in draw
renderer, self, dsu, self.suppressComposite)
File "/usr/local/lib/python3.5/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/matplotlib/axes/_base.py", line 2409, in draw
mimage._draw_list_compositing_images(renderer, self, dsu)
File "/usr/local/lib/python3.5/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/local/lib/python3.5/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/matplotlib/lines.py", line 776, in draw
self.recache()
File "/usr/local/lib/python3.5/site-packages/matplotlib/lines.py", line 696, in recache
raise RuntimeError('xdata and ydata must be the same length')
RuntimeError: xdata and ydata must be the same length
[2017-04-06 19:52:04,216] INFO:

End Session #0/1 of Trial #0/1 on PID 15881:
dqn_epsilon-2017_04_06_195200_t0_s0

[2017-04-06 19:52:04,348] INFO: Session complete, data saved to ./data/dqn_epsilon-2017_04_06_195200/dqn_epsilon-2017_04_06_195200_t0.json
[2017-04-06 19:52:04,414] INFO:

End Trial #0/1 on PID 15881:
dqn_epsilon-2017_04_06_195200_t0

[2017-04-06 19:52:04,416] INFO: Session complete, data saved to ./data/dqn_epsilon-2017_04_06_195200/dqn_epsilon-2017_04_06_195200_t0.json
Traceback (most recent call last):
File "main.py", line 5, in
run(args.experiment, **vars(args))
File "/Users/enzo/Desktop/openai_lab-master/rl/experiment.py", line 472, in run
return analyze_data(experiment_data)
File "/Users/enzo/Desktop/openai_lab-master/rl/analytics.py", line 447, in analyze_data
stats_df = raw_stats_df[STATS_COLS]
File "/usr/local/lib/python3.5/site-packages/pandas/core/frame.py", line 2053, in getitem
return self._getitem_array(key)
File "/usr/local/lib/python3.5/site-packages/pandas/core/frame.py", line 2097, in _getitem_array
indexer = self.ix._convert_to_indexer(key, axis=1)
File "/usr/local/lib/python3.5/site-packages/pandas/core/indexing.py", line 1230, in _convert_to_indexer
raise KeyError('%s not in index' % objarr[mask])
KeyError: "['best_session_epi' 'best_session_id' 'best_session_mean_rewards'\n 'best_session_stability' 'fitness_score' 'mean_rewards_per_epi_stats_mean'\n 'mean_rewards_stats_mean' 'mean_rewards_stats_max' 'epi_stats_mean'\n 'epi_stats_min' 'solved_ratio_of_sessions' 'max_total_rewards_stats_mean'\n 'trial_id'] not in index"

I fixed the issue by downgrading matplotlib to version 1.4.3

kengz commented

Thanks!
We'll test this on a few more machines to confirm then release a version lock. Let's leave this issue open until a fix is merged.

kengz commented

Addressed in release v1.0.3