Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with matplotlib 3.1.1 #18

Closed
os1a opened this issue Jul 4, 2019 · 4 comments
Closed

Compatibility with matplotlib 3.1.1 #18

os1a opened this issue Jul 4, 2019 · 4 comments
Labels

Comments

@os1a
Copy link

os1a commented Jul 4, 2019

Hi,
I have experienced some problems when using the tfplot using the new version of matplotlib.
More details about the error are:

Traceback (most recent call last):
  File "tmp.py", line 169, in <module>
    main()
  File "tmp.py", line 160, in main
    summary = session.run(summary_op)
  File "/home/makansio/venv/tf1.14/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 950, in run
    run_metadata_ptr)
  File "/home/makansio/venv/tf1.14/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1173, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/makansio/venv/tf1.14/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_run
    run_metadata)
  File "/home/makansio/venv/tf1.14/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1370, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.UnknownError: AttributeError: 'FigureCanvasBase' object has no attribute 'tostring_argb'
Traceback (most recent call last):

  File "/home/makansio/venv/tf1.14/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 209, in __call__
    ret = func(*args)

  File "/home/makansio/venv/tf1.14/lib/python3.6/site-packages/tfplot/ops.py", line 101, in _render_image
    image = figure.to_array(fig)

  File "/home/makansio/venv/tf1.14/lib/python3.6/site-packages/tfplot/figure.py", line 92, in to_array
    img = np.frombuffer(fig.canvas.tostring_argb(), dtype=np.uint8)

AttributeError: 'FigureCanvasBase' object has no attribute 'tostring_argb'

I have solved it by reinstalling an older version of matplotlib == 3.0.2

Best,
Osama

@wookayin
Copy link
Owner

Thanks for reporting it. Let me fix this very soon

@wookayin wookayin added the bug label Jul 22, 2019
@wookayin
Copy link
Owner

Upstream issue: matplotlib/matplotlib#12450

wookayin added a commit that referenced this issue Jul 23, 2019
Starting from matplotlib 3.1, Figure instances have .canvas attribute
by default, which however lacks tostring_argb(). To make it work
regardless of matplotlib version (<3.1, >=3.1), use agg-backend canvas.
@wookayin
Copy link
Owner

Fixed on master

@wookayin
Copy link
Owner

Bugfixed released as 0.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants