5

I recently upgraded ipython to 2.0.0 and can't get inline plots to work. If I try

%pylab inline
plot([1,2],[1,2])

I get the following output:

Populating the interactive namespace from numpy and matplotlib
[<matplotlib.lines.Line2D at 0x10ffcf080>]
/usr/local/lib/python3.4/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in image/png formatter: _image_module::readpng:  png_create_read_struct failed
  FormatterWarning,
<matplotlib.figure.Figure at 0x10e77ca58>

And in the console, I have the following error:

ERROR:tornado.application:Uncaught exception in /api/kernels/0a214dee-3143-4d34-89cb-9d65ce154fe6/shell
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/tornado/websocket.py", line 322, in wrapper
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.4/site-packages/IPython/html/services/kernels/handlers.py", line 122, in on_message
    self.session.send(self.zmq_stream, msg)
  File "/usr/local/lib/python3.4/site-packages/IPython/kernel/zmq/session.py", line 646, in send
    stream.send_multipart(to_send, copy=copy)
AttributeError: 'NoneType' object has no attribute 'send_multipart'

Any idea what's going on here?

Edit: I'm on python 3.4.0, ipython 2.0.0, and matplotlib 1.3.1

Alex Z
  • 1,449
  • 4
  • 20
  • 29
  • 1
    Looks like your ipython install is borked, I suspect because there are some old files hanging around. I would suggest deleting everything and re-installing. I would also suggest using virtual environments instead of installing at the system level. – tacaswell May 08 '14 at 19:29
  • Did you ever figure out what was causing this? – Mikko Ohtamaa Sep 01 '14 at 13:04
  • As the first possibilities, I would remove (or move to other name if you would save it) the ~/.ipython directory if there is one. Perhaps the settings of the previous version causes the problem. – Arpad Horvath -- Слава Україні Dec 29 '14 at 13:22

1 Answers1

0

As tcaswell mentioned, the easiest way of dealing with issues with dependencies of individual python modules is to test them in a virtual environment- effectively giving you a clean install. If nothing else, this helps the debugging process.

  • Make a virtual environment called myenv by running this in your terminal: $ virtualenv myenv

  • Activate the environment by running from terminal: $ source myenv/bin/activate.

  • Install ipython (the name of your virtualenvironment is now in parentheses at your prompt: (myenv)$ pip install ipython notebook

  • Once you're done with the virtual environment, run $ deactivate or close your terminal session.

There are a variety of good guides for virtual environments; I'd recommend starting here. If installing within a virtual environment doesn't fix things, there might be a bigger issue. Once you're done using the virtual environment, you can simply delete the folder created with its name (in this case myenv).

And finally, I'd recommend using %matplotlib inline over %pylab inline as discussed in this question.

Community
  • 1
  • 1
emunsing
  • 9,536
  • 3
  • 23
  • 29