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

libpng error when plotting in notebook after importing tensorflow #1927

Closed
bnaul opened this issue Apr 13, 2016 · 3 comments
Closed

libpng error when plotting in notebook after importing tensorflow #1927

bnaul opened this issue Apr 13, 2016 · 3 comments

Comments

@bnaul
Copy link

bnaul commented Apr 13, 2016

Environment info

Operating System: CentOS Linux 7 x86_64

Tensorflow version

0.8.0rc0 (from binary)

Steps to reproduce

  1. Fresh conda environment: conda create -y -n plt_tf python=3.4 jupyter notebook matplotlib numpy && source activate plt_tf
  2. pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0rc0-cp34-cp34m-linux_x86_64.whl
  3. Launch a notebook server and execute the following:
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline

plt.plot([1,2], [1,2])

Logs or other output that would be helpful

Traceback:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/home/bnaul/miniconda3/envs/plt_tf/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
    337                 pass
    338             else:
--> 339                 return printer(obj)
    340             # Finally look for special method names
    341             method = _safe_get_formatter_method(obj, self.print_method)

/home/bnaul/miniconda3/envs/plt_tf/lib/python3.5/site-packages/IPython/core/pylabtools.py in <lambda>(fig)
    224 
    225     if 'png' in formats:
--> 226         png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
    227     if 'retina' in formats or 'png2x' in formats:
    228         png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))

/home/bnaul/miniconda3/envs/plt_tf/lib/python3.5/site-packages/IPython/core/pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
    115 
    116     bytes_io = BytesIO()
--> 117     fig.canvas.print_figure(bytes_io, **kw)
    118     data = bytes_io.getvalue()
    119     if fmt == 'svg':

/home/bnaul/miniconda3/envs/plt_tf/lib/python3.5/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
   2178                     orientation=orientation,
   2179                     dryrun=True,
-> 2180                     **kwargs)
   2181                 renderer = self.figure._cachedRenderer
   2182                 bbox_inches = self.figure.get_tightbbox(renderer)

/home/bnaul/miniconda3/envs/plt_tf/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
    535             close = False
    536         try:
--> 537             _png.write_png(renderer._renderer, filename_or_obj, self.figure.dpi)
    538         finally:
    539             if close:

RuntimeError: Could not create write struct

Server log:

libpng warning: Application was compiled with png.h from libpng-1.6.17
libpng warning: Application  is  running with png.c from libpng-1.2.53
libpng error: Incompatible libpng version in application and library

Workaround

Importing tensorflow after matplotlib prevents this from happening.

@bnaul
Copy link
Author

bnaul commented Apr 13, 2016

Similar to #1924?

@mrry
Copy link
Contributor

mrry commented Apr 15, 2016

Since this looks like the same issue as #1924, let's close this issue for now and continue the discussion over there.

@mrry mrry closed this as completed Apr 15, 2016
@JensenQi
Copy link

JensenQi commented Jul 8, 2016

put the "import pylab" before "import tensorflow as tf" and it may help
so, the code likes this

import pylab
import tensorflow as tf

blabla....

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

No branches or pull requests

4 participants