2

我正在尝试使用该modin包来加快我的 pandas 数据框计算。简而言之,安装并不像pip install modin

当简单地运行时,pip install modin一切似乎都很好(除了 pip 升级警告)。到目前为止一切都很好...

WARNING: You are using pip version 19.3; however, version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(base) C:\Users\Merv Merzoug>pip install modin
Requirement already satisfied: modin in c:\users\merv merzoug\anaconda3\lib\site-packages (0.6.2)
Requirement already satisfied: pandas==0.25.1 in c:\users\merv merzoug\anaconda3\lib\site-packages (from modin) (0.25.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\merv merzoug\anaconda3\lib\site-packages (from pandas==0.25.1->modin) (2019.3)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\merv merzoug\anaconda3\lib\site-packages (from pandas==0.25.1->modin) (2.7.3)
Requirement already satisfied: numpy>=1.13.3 in c:\users\merv merzoug\appdata\roaming\python\python36\site-packages (from pandas==0.25.1->modin) (1.16.4)
Requirement already satisfied: six>=1.5 in c:\users\merv merzoug\anaconda3\lib\site-packages (from python-dateutil>=2.6.1->pandas==0.25.1->modin) (1.12.0)
WARNING: You are using pip version 19.3; however, version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

然后我尝试仅导入包:import modin.pandas as pd根据文档,我得到以下回溯:

ImportError: Please `pip install modin[dask] to install compatible Dask version.

好吧...所以我按照他们告诉我的去做。运行pip install modin[dask],我收到以下...

    (base) C:\Users\Merv Merzoug>pip install modin[dask]
Requirement already satisfied: modin[dask] in c:\users\merv merzoug\anaconda3\lib\site-packages (0.6.2)
Requirement already satisfied: pandas==0.25.1 in c:\users\merv merzoug\anaconda3\lib\site-packages (from modin[dask]) (0.25.1)
Requirement already satisfied: dask>=2.1.0; extra == "dask" in c:\users\merv merzoug\anaconda3\lib\site-packages (from modin[dask]) (2.7.0)
Requirement already satisfied: distributed>=2.3.2; extra == "dask" in c:\users\merv merzoug\anaconda3\lib\site-packages (from modin[dask]) (2.7.0)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\merv merzoug\anaconda3\lib\site-packages (from pandas==0.25.1->modin[dask]) (2.7.3)
Requirement already satisfied: pytz>=2017.2 in c:\users\merv merzoug\anaconda3\lib\site-packages (from pandas==0.25.1->modin[dask]) (2019.3)
Requirement already satisfied: numpy>=1.13.3 in c:\users\merv merzoug\appdata\roaming\python\python36\site-packages (from pandas==0.25.1->modin[dask]) (1.16.4)
Requirement already satisfied: sortedcontainers!=2.0.0,!=2.0.1 in c:\users\merv merzoug\appdata\roaming\python\python36\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (1.5.9)
Requirement already satisfied: tornado>=5 in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (5.1.1)
Requirement already satisfied: zict>=0.1.3 in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (0.1.3)
Requirement already satisfied: msgpack in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (0.6.2)
Requirement already satisfied: psutil>=5.0 in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (5.4.5)
Requirement already satisfied: cloudpickle>=0.2.2 in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (0.5.3)
Requirement already satisfied: click>=6.6 in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (6.7)
Requirement already satisfied: pyyaml in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (5.1.2)
Requirement already satisfied: tblib in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (1.3.2)
Requirement already satisfied: toolz>=0.7.4 in c:\users\merv merzoug\anaconda3\lib\site-packages (from distributed>=2.3.2; extra == "dask"->modin[dask]) (0.9.0)
Requirement already satisfied: six>=1.5 in c:\users\merv merzoug\anaconda3\lib\site-packages (from python-dateutil>=2.6.1->pandas==0.25.1->modin[dask]) (1.12.0)
Requirement already satisfied: heapdict in c:\users\merv merzoug\anaconda3\lib\site-packages (from zict>=0.1.3->distributed>=2.3.2; extra == "dask"->modin[dask]) (1.0.0)
WARNING: You are using pip version 19.3; however, version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

好的,好的,看起来我已经安装了所有东西......让我们再次尝试导入......

import modin.pandas as pd

这会产生相同的回溯:

ImportError: Please `pip install modin[dask] to install compatible Dask version.

我做错了什么?谢谢!

4

2 回答 2

8

在导入 modin 之前,您必须定义 Compute Engine。

试试这个(如 modin 的 github 项目页面中所述):

import os

#USE ONLY ONE OF THESE:

os.environ["MODIN_ENGINE"] = "ray"  # Modin will use Ray
os.environ["MODIN_ENGINE"] = "dask"  # Modin will use Dask

import modin.pandas as pd
于 2020-01-15T11:38:15.237 回答
0

如果您在 colab 中运行它,请尝试使用以下命令:

!pip install -U ipykernel
!pip install modin[dask]

如果在运行上述命令后导入时遇到相同的错误,请尝试重新启动内核并再次导入。

更多信息可以在这里找到。

于 2020-01-13T05:39:49.573 回答