2014-04-16 43 views
0

我在Ubuntu上使用Ipython作爲Enthought Python Distribution(EPD)的一部分。 將Ipython從1.1.0-3升級到2.0.0-1和將pyzmq從2.2.0-4升級到14.1.1.-1時,遇到一些問題。由於ZMQ中的簽名/未簽名操作,內嵌3D散點圖 失敗。在ubuntu上升級Ipython後內聯3D散點圖失敗

一個代碼示例:

%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 

下載對於舊版本的Ipython,事情再次運行良好。所以在Ubuntu上似乎有一些Ipython 2.0.0-1的問題。

感謝您的支持!

+0

是否pyzmq版本變化,或者僅僅是IPython的版本?我希望這是針對pyzmq的。 – minrk

+0

@minrk:我認爲,IPython以及pyzmq在發生此問題時已經更新。 – user3540594

+0

你可以檢查'nosetests zmq'的測試輸出嗎? – minrk

回答

0

這是32b Python中pyzmq≥14.0的錯誤。它應該由this PR修復,這應該在接下來的幾天內以pyzmq-14.2發佈。即時的解決方法包括:

  • 使用64B的Python,如果可能的話
  • 使用pyzmq 13
  • 手動應用上述補丁並安裝pyzmq