【问题标题】:Inlining of 3D scatterplots fails after upgrading Ipython on ubuntu在 ubuntu 上升级 Ipython 后,3D 散点图的内联失败
【发布时间】:2014-04-16 11:51:56
【问题描述】:

我在 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 笔记本中运行时,我收到以下错误消息:

溢出错误:无法将负值转换为无符号 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

降级到旧版本的 Ipython 后,一切又恢复正常了。所以 ubuntu 上的 Ipython 2.0.0-1 似乎有些问题。

感谢您的支持!

【问题讨论】:

  • 是 pyzmq 版本变了,还是只是 IPython 版本变了?我希望这特定于 pyzmq。
  • @minrk:我认为,当这个问题发生时,IPython 和 pyzmq 刚刚更新。
  • 你能检查nosetests zmq的测试输出吗?
  • sys.maxint的值是多少?
  • 什么 ubuntu 版本?

标签: ubuntu ipython scatter-plot enthought


【解决方案1】:

这是 32b Python 上 pyzmq ≥ 14.0 中的一个错误。它应该由this PR 修复,它应该在接下来的几天内发布在 pyzmq-14.2 中。即时解决方法包括:

  • 尽可能使用 64b Python
  • 使用 pyzmq 13
  • 手动打上上述补丁并安装pyzmq

【讨论】:

    猜你喜欢
    • 2011-09-22
    • 2016-04-28
    • 1970-01-01
    • 2021-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-08
    • 2021-04-14
    相关资源
    最近更新 更多