1
votes

i am trying to get inline graphs working in iPython notebook.. i begin by starting ipython with the command ipython notebook --pylab inline.

when i try to use the plot() function i get the following error

enter image description here

im running on OSX 10.6.8 and running ipython out of a virtualenv i have matplotlib and libpng installed

i also get this warning in the terminal

libpng warning: Application built with libpng-1.2.41 but running with 1.5.13

and plot() works normally when i use ipython in the terminal only when i use ipython notebook i get this error.. can someone help me with this..?

4

4 Answers

1
votes

I had this problem as well. Another solution is to change the format which the notebook will render images in, from 'png' to 'svg'. This can be done in your config file. Mine is located at:

~/.ipython/profile_default/ipython_notebook_config.py

There is a line that looks like this

# c.InlineBackend.figure_format = 'png'

Uncommenting and changing to 'svg' did the trick for me:

c.InlineBackend.figure_format = 'svg'
0
votes

This recent question on this board is similar to yours: matplotlib and libpng issues with ipython notebook

See if the solution there solves your issue.

0
votes

so i finally got this working.. first off i had to get all my outdated ports updated first i did port selfupdate then sudo port update outdated

after that i reinstalled ipython using mac ports sudo port install py27-ipython then i had to install tornado and pyzmq respectively as ipython depends on it sudo port install py27-tornado sudo port install py27-zmq

and then ran it from the terminal

ipython notebook --pylab inline

everything works fine now i can plot maps inline in ipython! i guess the reason it didnt work before was some problems with pip maybe its installing matplotlib that is build only for libpng 1.2.41 ??... so anyways if anyone else faces this problem id suggest reinstalling all the libraries and ipython via mac ports thats the only thing that worked for me.

0
votes

Since it was complaining that the versions of libpng used for building and for running are different, I have reinstalled the matplotlib by forcing the path to includes.

CFLAGS="`libpng-config --cflags`" pip install matplotlib -I