pandas 无法完全安装和导入Modin包

qmelpv7a  于 2022-12-09  发布在  其他
关注(0)|答案(3)|浏览(257)

我正在尝试使用modin包来加速pandas Dataframe 的计算。
当简单地运行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.

我做错了什么?谢谢!

xqkwcwgp

xqkwcwgp1#

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

9bfwbjaz2#

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

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

如果在运行上述命令后导入时出现相同的错误,请尝试重新启动内核并再次导入。
更多信息可在here中找到。

uubf1zoe

uubf1zoe3#

请检查一个类似的问题,Modin conflicts with dask安装modin并导入包。

相关问题