尝试使用IPython.display.Audio时,Jupyer Notebook会出现Cython错误

时间:2017-01-16 05:53:48

标签: ipython jupyter-notebook jupyter

以下代码会在我的机器上重现错误:

from IPython.display import Audio
Audio(filename='sample.mp3')

笔记本无法执行或显示消息,在终端的日志中输出

    ERROR:tornado.general:Uncaught exception, closing connection.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
    callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 107, in _handle_event
    event_f()
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 199, in <lambda>
    self.schedule(lambda : self._really_send(*args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 207, in _really_send
    self.socket.send_multipart(msg, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/zmq/sugar/socket.py", line 236, in send_multipart
    self.send(msg, SNDMORE|flags, copy=copy, track=track)
  File "socket.pyx", line 565, in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5263)
  File "socket.pyx", line 619, in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5111)
  File "message.pyx", line 183, in zmq.backend.cython.message.Frame.__cinit__ (zmq/backend/cython/message.c:1682)
OverflowError: can't convert negative value to size_t
ERROR:tornado.general:Uncaught exception, closing connection.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 433, in _handle_events
    self._handle_recv()
  File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 465, in _handle_recv
    self._run_callback(callback, msg)
  File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
    callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 107, in _handle_event
    event_f()
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 199, in <lambda>
    self.schedule(lambda : self._really_send(*args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 207, in _really_send
    self.socket.send_multipart(msg, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/zmq/sugar/socket.py", line 236, in send_multipart
    self.send(msg, SNDMORE|flags, copy=copy, track=track)
  File "socket.pyx", line 565, in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5263)
  File "socket.pyx", line 619, in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5111)
  File "message.pyx", line 183, in zmq.backend.cython.message.Frame.__cinit__ (zmq/backend/cython/message.c:1682)
OverflowError: can't convert negative value to size_t
ERROR:tornado.application:Exception in callback None
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 887, in start
    handler_func(fd_obj, events)
  File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 433, in _handle_events
    self._handle_recv()
  File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 465, in _handle_recv
    self._run_callback(callback, msg)
  File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
    callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 107, in _handle_event
    event_f()
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 199, in <lambda>
    self.schedule(lambda : self._really_send(*args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.py", line 207, in _really_send
    self.socket.send_multipart(msg, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/zmq/sugar/socket.py", line 236, in send_multipart
    self.send(msg, SNDMORE|flags, copy=copy, track=track)
  File "socket.pyx", line 565, in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5263)
  File "socket.pyx", line 619, in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5111)
  File "message.pyx", line 183, in zmq.backend.cython.message.Frame.__cinit__ (zmq/backend/cython/message.c:1682)
OverflowError: can't convert negative value to size_t

错误不是特定于音频文件,使用其他音频文件或放入numpy数组会产生完全相同的错误。

我错过了什么?

1 个答案:

答案 0 :(得分:0)

有人建议由于pyzmq(https://github.com/CellProfiler/CellProfiler/issues/1676)的过时版本而生成相同的错误消息。通过pip安装最新版本的pyzmq已在我的系统中解决了这个问题。希望,这有帮助。