我在ubuntu上使用Ipython作为Enthought Python Distribution(EPD)的一部分。 将Ipython从1.1.0-3升级到2.0.0-1,将pyzmq从2.2.0-4升级到14.1.1.-1,我遇到了一些问题。内联3D散点图 由于ZMQ中的签名/未签名操作,图表失败。
代码示例:
%matplotlib inline
import matplotlib.pylab as plt
from mpl_toolkits.mplot3d import Axes3D
import random
fig = plt.figure(figsize = (10,8))
ax = fig.add_subplot(111, projection='3d')
xs,ys, zs = [], [], []
for frame_time in range(100):
xs.append(random.random())
ys.append(random.random())
zs.append(random.random())
ax.scatter(xs, ys, zs)
尝试在Ipython笔记本中运行时,我收到以下错误消息:
OverflowError:无法将负值转换为无符号PY_LONG_LONG
完整的错误消息:
<mpl_toolkits.mplot3d.art3d.Patch3DCollection at 0x9c0560c>
---------------------------------------------------------------------------
OverflowError Traceback (most recent call last)
/home/dsg-labuser/EPD/lib/python2.7/site-packages/IPython/kernel/zmq/pylab /backend_inline.pyc in show(close)
41 try:
42 for figure_manager in Gcf.get_all_fig_managers():
---> 43 display(figure_manager.canvas.figure)
44 finally:
45 show._to_draw = []
/home/dsg-labuser/EPD/lib/python2.7/site-packages/IPython/core/display.pyc in display(*objs, **kwargs)
133 # kwarg-specified metadata gets precedence
134 _merge(md_dict, metadata)
--> 135 publish_display_data('display', format_dict, md_dict)
136
137
/home/dsg-labuser/EPD/lib/python2.7/site-packages/IPython/core/displaypub.pyc in publish_display_data(source, data, metadata)
172 source,
173 data,
--> 174 metadata
175 )
176
/home/dsg-labuser/EPD/lib/python2.7/site-packages/IPython/kernel/zmq/zmqshell.pyc in publish(self, source, data, metadata)
86 self.session.send(
87 self.pub_socket, u'display_data', json_clean(content),
---> 88 parent=self.parent_header, ident=self.topic,
89 )
90
/home/dsg-labuser/EPD/lib/python2.7/site-packages/IPython/kernel/zmq/session.pyc in send(self, stream, msg_or_type, content, parent, ident, buffers, track, header, metadata)
644 # use dummy tracker, which will be done immediately
645 tracker = DONE
--> 646 stream.send_multipart(to_send, copy=copy)
647
648 if self.debug:
/home/dsg-labuser/EPD/lib/python2.7/site-packages/zmq/sugar/socket.pyc in send_multipart(self, msg_parts, flags, copy, track)
263 """
264 for msg in msg_parts[:-1]:
--> 265 self.send(msg, SNDMORE|flags, copy=copy, track=track)
266 # Send the last part without the extra SNDMORE flag.
267 return self.send(msg_parts[-1], flags, copy=copy, track=track)
/home/dsg-labuser/EPD/lib/python2.7/site-packages/zmq/backend/cython/socket.so in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5298)()
/home/dsg-labuser/EPD/lib/python2.7/site-packages/zmq/backend/cython/socket.so in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5146)()
/home/dsg-labuser/EPD/lib/python2.7/site-packages/zmq/backend/cython/message.so in zmq.backend.cython.message.Frame.__cinit__ (zmq/backend/cython/message.c:1645)()
OverflowError: can't convert negative value to unsigned PY_LONG_LONG
Afer降级到旧版本的Ipython,事情再次正常。因此,ubuntu上的Ipython 2.0.0-1似乎存在一些问题。
感谢您的支持!
答案 0 :(得分:0)
这是32b Python上pyzmq≥14.0的错误。它应该由this PR修复,这应该在接下来的几天内在pyzmq-14.2中发布。立即解决方法包括: