【问题标题】:Adding pandas dependencies after kedro new在 kedro new 之后添加 pandas 依赖项
【发布时间】:2020-10-23 20:44:47
【问题描述】:

我使用kedro new 开始了一个新项目,但没有添加 iris 示例中的文件。原来的requirements.txt 看起来像:

black==v19.10b0
flake8>=3.7.9, <4.0
ipython~=7.0
isort>=4.3.21, <5.0
jupyter~=1.0
jupyter_client>=5.1, < 7.0
jupyterlab==0.31.1
kedro==0.16.6
nbstripout==0.3.3
pytest-cov~=2.5
pytest-mock>=1.7.1, <2.0
pytest~=5.0
wheel==0.32.2

然后我运行kedro install 来安装软件包,生成requirements.inrequirements.txt。我现在想安装处理 pandas 和 csv 文件所需的依赖项。我尝试使用以下行更新requirements.inkedro[pandas]==0.16.6,然后执行kedro install --build-reqs。但是,该行因错误而失败:

Could not find a version that matches pyarrow<1.0.0,<2.0dev,>=0.12.0,>=1.0.0 (from kedro[pandas]==0.16.6->-r /lrlhps/data/busanalytics/Guilherme/Projects/kedro-environment/spaceflights/src/requirements.in (line 8))
Tried: 0.9.0, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.13.0, 0.14.0, 0.15.1, 0.16.0, 0.16.0, 0.16.0, 0.16.0, 0.17.0, 0.17.0, 0.17.0, 0.17.0, 0.17.1, 0.17.1, 0.17.1, 0.17.1, 1.0.0, 1.0.0, 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.0.1, 1.0.1, 2.0.0, 2.0.0, 2.0.0
There are incompatible versions in the resolved dependencies:
  pyarrow<2.0dev,>=1.0.0 (from google-cloud-bigquery[bqstorage,pandas]==2.2.0->pandas-gbq==0.14.0->kedro[pandas]==0.16.6->-r /Projects/kedro/spaceflights/src/requirements.in (line 8))
  pyarrow<1.0.0,>=0.12.0 (from kedro[pandas]==0.16.6->-r /Projects/kedro/spaceflights/src/requirements.in (line 8))

问题:是否可以更新 requirements.in 并使用 --build-reqs 选项安装 pandas 依赖项?还是必须用 pip 安装依赖?

【问题讨论】:

  • 不是一个很好的解决方案,但通常我只是制作一个全新的环境并重新安装所有内容。

标签: python pandas kedro


【解决方案1】:

您应该能够通过添加您希望使用的特定组件来安装 pandas,如文档中所示:

上面的依赖对于某些项目可能已经足够了,但是对于 spaceflights 项目,需要为 pandas 项目添加一个需求 因为您正在使用 CSV 和 Excel 文件。您可以添加必要的 这些文件类型的依赖关系如下:

kedro[pandas.CSVDataSet,pandas.ExcelDataSet]==0.17.0

https://kedro.readthedocs.io/en/stable/03_tutorial/02_tutorial_template.html#add-and-remove-project-specific-dependencies

比如添加后

kedro[pandas.CSVDataSet]==0.17.0

到您的requirements.in 并发出kedro build-reqs,您应该会看到

kedro[pandas.csvdataset]==0.17.0  # via -r /.../src/requirements.in
(...)
pandas==1.2.0                     # via kedro

在您的 requirements.txt 文件中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-19
    • 1970-01-01
    • 2013-05-20
    • 1970-01-01
    • 1970-01-01
    • 2018-01-08
    • 1970-01-01
    相关资源
    最近更新 更多