AttributeError:模块'dask'没有属性'set_options'

问题描述 投票:0回答:1

我是使用Dask的新手,我在MacBook MacOS High Sierra 10.13.6上安装了新版本2.12.0。当我尝试使用以下代码启动分布式模式时:

from dask.distributed import Client
c = Client()

我收到以下错误

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-67101dbde0b6> in <module>()
      1 from dask.distributed import Client
----> 2 c = Client()

~/anaconda3/lib/python3.6/site-packages/distributed/client.py in __init__(self, address, loop, timeout, set_as_default, scheduler_file, security, asynchronous, name, heartbeat_interval, **kwargs)
    554         if set_as_default:
    555             self._previous_get = _globals.get('get')
--> 556             dask.set_options(get=self.get)
    557             self._previous_shuffle = _globals.get('shuffle')
    558             dask.set_options(shuffle='tasks')

AttributeError: module 'dask' has no attribute 'set_options'

[另外,如果我实例化c = Client(set_as_default=False),则集群似乎成功提升了,因为我获得了仪表板(see this image)的连接信息。但是,当我浏览仪表板时,following error is triggered

根据documentation提升单个机器集群似乎微不足道,但我不知道这可能是错的。如果有人可以指导我如何解决此事件,我将不胜感激;)

python dask distributed attributeerror
1个回答
0
投票

您的源文件名为dask.py,这会在模块dask.pydask包之间引入命名冲突,而模块在以后的import语句中优先。因此,当distributed/client.py尝试调用dask.set_options时,由于AttributeError失败,因为您的模块不提供此功能。

[运行此dask.py模块后,python缓存已编译的python代码。因此,即使将模块重命名为其他名称,导入名称冲突仍然存在。要解决此问题,您应该删除__pycache__目录,然后您会发现模块已成功执行。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.