无法完全安装和导入Modin软件包

时间:2019-11-14 02:06:27

标签: python-3.x pandas modin

我正在尝试使用modin包来加快我的熊猫数据框的计算速度。 简而言之,安装并不像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.

我做错了什么?谢谢!

2 个答案:

答案 0 :(得分:6)

在导入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

答案 1 :(得分:0)

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

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

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

更多信息here