为什么DASK数据框导入错误即使在成功完成安装后仍然发生?



我正在尝试DASK。我点击了以下链接:

https://docs.dask.org/en/latest/install.html

我成功安装了一切。例如,我在虚拟环境中运行以下命令:

conda install dask
python -m pip install "dask[complete]"
python -m pip install "dask[array]"       # Install requirements for dask array
python -m pip install "dask[dataframe]"   # Install requirements for dask dataframe
python -m pip install "dask[diagnostics]" # Install requirements for dask diagnostics
python -m pip install "dask[distributed]" # Install requirements for distributed dask

所有这些都显示导入成功。但是当我尝试导入CSV文件时,它会给我以下命令的错误,从我的Jupyter Notebook或Python解释器:

import dask.dataframe as dd

ImportError                               Traceback (most recent call last)
~/.conda/envs/latest/lib/python3.7/site-packages/dask/dataframe/__init__.py in <module>
2     from ..base import compute
----> 3     from . import backends, dispatch, rolling
4     from .core import (
~/.conda/envs/latest/lib/python3.7/site-packages/dask/dataframe/backends.py in <module>
3 import numpy as np
----> 4 import pandas as pd
5 from pandas.api.types import (
~/.conda/envs/latest/lib/python3.7/site-packages/pandas/__init__.py in <module>
54 
---> 55 from pandas.core.api import (
56     # dtype
~/.conda/envs/latest/lib/python3.7/site-packages/pandas/core/api.py in <module>
14 from pandas.core.algorithms import factorize, unique, value_counts
---> 15 from pandas.core.arrays import Categorical
16 from pandas.core.arrays.boolean import BooleanDtype
~/.conda/envs/latest/lib/python3.7/site-packages/pandas/core/arrays/__init__.py in <module>
10 from pandas.core.arrays.integer import IntegerArray, integer_array
---> 11 from pandas.core.arrays.interval import IntervalArray
12 from pandas.core.arrays.numpy_ import PandasArray, PandasDtype
~/.conda/envs/latest/lib/python3.7/site-packages/pandas/core/arrays/interval.py in <module>
44 from pandas.core.indexers import check_array_indexer
---> 45 from pandas.core.indexes.base import ensure_index
46 
~/.conda/envs/latest/lib/python3.7/site-packages/pandas/core/indexes/base.py in <module>
76 from pandas.core.ops.invalid import make_invalid_op
---> 77 from pandas.core.strings import StringMethods
78 
~/.conda/envs/latest/lib/python3.7/site-packages/pandas/core/strings/__init__.py in <module>
29 
---> 30 from pandas.core.strings.accessor import StringMethods
31 from pandas.core.strings.base import BaseStringArrayMethods
~/.conda/envs/latest/lib/python3.7/site-packages/pandas/core/strings/accessor.py in <module>
15 import pandas._libs.lib as lib
---> 16 from pandas._typing import (
17     DtypeObj,
ImportError: cannot import name 'DtypeObj' from 'pandas._typing' (/home/mdabdullahal.alamin/.conda/envs/latest/lib/python3.7/site-packages/pandas/_typing.py)
The above exception was the direct cause of the following exception:
ImportError                               Traceback (most recent call last)
/tmp/ipykernel_4116022/1671061512.py in <module>
----> 1 import dask.dataframe as dd
2 # df  = dd.read_csv(file_name)
3 # print(len(df))
~/.conda/envs/latest/lib/python3.7/site-packages/dask/dataframe/__init__.py in <module>
58         '  python -m pip install "dask[dataframe]" --upgrade  # or python -m pip install'
59     )
---> 60     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

我甚至在任务安装后停用和重新激活虚拟环境。但它仍然不工作,并给出错误:

ImportError: Dask dataframe requirements are not installed.

这是一个非常奇怪的问题。我仍然不确定为什么会发生这种情况。我有一个conda我在虚拟环境中使用Pandas和Numpy进行数据分析,后来我安装了DASK

所有这些安装命令都是成功的。但由于某些原因,它给了我错误。我重新启动,停用和重新激活的环境,但它没有工作。后来我刚刚更新了Conda环境,它开始工作了。

conda -y update --all

修复了这个问题。在安装DASK时没有给我任何错误,但内部可能是一些库没有正确更新。

相关内容

  • 没有找到相关文章

最新更新