【问题标题】:not able to install dask on google colab无法在 google colab 上安装 dask
【发布时间】:2021-06-23 19:23:32
【问题描述】:

我使用 pip 方法在 google lab 上安装。但我不确定为什么它不起作用。 这是我得到的 代码

pip install "dask[dataframe]" --upgrade

错误

Requirement already up-to-date: dask[dataframe] in /usr/local/lib/python3.7/dist-packages (2021.3.1)
Requirement already satisfied, skipping upgrade: partd>=0.3.10 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.1.0)
Requirement already satisfied, skipping upgrade: cloudpickle>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.3.0)
Requirement already satisfied, skipping upgrade: toolz>=0.8.2 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (0.11.1)
Requirement already satisfied, skipping upgrade: fsspec>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (0.8.7)
Requirement already satisfied, skipping upgrade: pyyaml in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (3.13)
Requirement already satisfied, skipping upgrade: numpy>=1.16; extra == "dataframe" in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.19.5)
Requirement already satisfied, skipping upgrade: pandas>=0.25.0; extra == "dataframe" in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.1.5)
Requirement already satisfied, skipping upgrade: locket in /usr/local/lib/python3.7/dist-packages (from partd>=0.3.10->dask[dataframe]) (0.2.1)
Requirement already satisfied, skipping upgrade: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from fsspec>=0.6.0->dask[dataframe]) (3.7.2)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (2.8.1)
Requirement already satisfied, skipping upgrade: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (2018.9)
Requirement already satisfied, skipping upgrade: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->fsspec>=0.6.0->dask[dataframe]) (3.4.1)
Requirement already satisfied, skipping upgrade: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->fsspec>=0.6.0->dask[dataframe]) (3.7.4.3)
Requirement already satisfied, skipping upgrade: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (1.15.0)

如果我使用数据框。发生这样的通知 代码

 import dask.dataframe as dd

错误

ImportError                               Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/dask/dataframe/__init__.py in <module>()
     34     from .optimize import optimize
---> 35     from .multi import merge, concat, merge_asof
     36     from . import rolling, backends

3 frames
ImportError: cannot import name 'keys_in_tasks' from 'dask.core' (/usr/local/lib/python3.7/dist-packages/dask/core.py)

The above exception was the direct cause of the following exception:

ImportError                               Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/dask/dataframe/__init__.py in <module>()
     55         '  python -m pip install "dask[dataframe]" --upgrade  # or python -m pip install'
     56     )
---> 57     raise ImportError(msg) from e

ImportError: Dask dataframe requirements are not installed.

Please either conda or pip install as follows:

  conda install dask                     # either conda install
  python -m pip install "dask[dataframe]" --upgrade  # or python -m pip install

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

我是用google colab写的,为什么这里没有?我该如何解决?

【问题讨论】:

  • 如果我在 Colab 笔记本中运行 !pip install "dask[dataframe]",然后运行 ​​import dask.dataframe as dd,则不会出现任何错误。
  • @AlexK 我还是遇到了同样的问题。这是colab造成的吗?
  • 也许,有一个 Github 问题,推荐的解决方案可能对您有所帮助:github.com/dask/dask/issues/6301
  • @AlexK,谢谢,但我已经尝试过了。它也不起作用。我刚刚通过将每个代码复制到一个新的 colab 文件中来解决。有用。但不确定下次我打开它是否有效

标签: python dataframe google-colaboratory dask


【解决方案1】:

试试这个。

!python -m pip install "dask[complete]"
import dask
import dask.dataframe as dd

【讨论】:

    猜你喜欢
    • 2019-08-28
    • 2021-11-18
    • 2019-06-04
    • 2021-05-30
    • 2021-04-12
    • 2019-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多