ImportError:无法导入名称锁

时间:2016-06-29 17:16:39

标签: ipython tornado bokeh jupyter-notebook

我帮助那些在Jupyter中用散景看到这个错误的人:

from bokeh.plotting import figure, output_notebook, show

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-fa374f2df119> in <module>()
----> 1 from bokeh.plotting import figure, output_notebook, show

/resources/.virtualenv/python2/lib/python2.7/site-packages/bokeh/plotting/__init__.py in <module>()
      5 from ..models.layouts import Row, Column; Row, Column
      6 
----> 7 from ..io import curdoc; curdoc
      8 from ..io import output_file; output_file
      9 from ..io import output_notebook; output_notebook

/resources/.virtualenv/python2/lib/python2.7/site-packages/bokeh/io.py in <module>()
     27 
     28 # Bokeh imports
---> 29 from .core.state import State
     30 from .document import Document
     31 from .embed import notebook_div, standalone_html_page_for_models, autoload_server

/resources/.virtualenv/python2/lib/python2.7/site-packages/bokeh/core/state.py in <module>()
     44 from ..document import Document
     45 from ..resources import Resources, _SessionCoordinates
---> 46 from ..client import DEFAULT_SESSION_ID
     47 
     48 #-----------------------------------------------------------------------------

/resources/.virtualenv/python2/lib/python2.7/site-packages/bokeh/client/__init__.py in <module>()
      4 from __future__ import absolute_import
      5 
----> 6 from .session import ClientSession, pull_session, push_session, show_session, DEFAULT_SESSION_ID

/resources/.virtualenv/python2/lib/python2.7/site-packages/bokeh/client/session.py in <module>()
      8 log = logging.getLogger(__name__)
      9 
---> 10 from ._connection import ClientConnection
     11 
     12 from bokeh.resources import ( DEFAULT_SERVER_WEBSOCKET_URL,

/resources/.virtualenv/python2/lib/python2.7/site-packages/bokeh/client/_connection.py in <module>()
      9 log = logging.getLogger(__name__)
     10 
---> 11 from tornado import gen, locks
     12 from tornado.httpclient import HTTPRequest
     13 from tornado.ioloop import IOLoop

ImportError: cannot import name locks

奇怪的是,我无法使用相同版本的散景,相同版本的龙卷风等重现我自己的Jupyter中的错误。

以下是软件包版本:

bokeh (0.12.0)
tornado (4.3)

什么可能导致此错误?

1 个答案:

答案 0 :(得分:2)

Tornado 4.2中添加了tornado.locks模块,所以我怀疑,虽然你的朋友认为他们正在运行最新的Tornado,但事实上他们已经安装了旧的。