首页 > 解决方案 > Conda 拒绝安装 requirements.txt 中的软件包只是因为一些异常值,如何解决?

问题描述

我正在使用 requirements.txt 来管理我的 python 依赖项:

six
tqdm
future
numpy
brine

scipy
matplotlib

# birdseye
shapely

git+https://github.com/tribbloid/jupyerlab-desktop.git#subdirectory=python
jupytext

# pyre-check
# deprecated

torch >= 1.2.0
# tensorboard
# opencv >= 4.0.0

# prototypes
git+https://github.com/pytorch/vision.git@v0.4.0#egg=torchvision
tb-nightly

我的环境是 python 3.7 上的 conda env。我试图使用一些命令来安装这些软件包,但是当我运行时:

conda install --file requirements.txt

我收到以下错误消息:

$ conda install --file ./requirements.txt 
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - tb-nightly
  - //github.com/tribbloid/jupyerlab-desktop.git
  - torch[version='>=1.2.0']
  - //github.com/pytorch/vision.git@v0.4.0
  - brine

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

似乎 conda 拒绝安装它们中的任何一个只是因为它找不到 3 个软件包!(他们在 PyPI 上)这个设计有什么意义,我应该怎么做才能修复它?

我的最终目标是尽可能使用 conda,如果它们仅在 PyPI 上,则回退到 pip,整个过程应该是可重复的和完全自动化的。

标签: pythonanacondacondarequirements.txt

解决方案


您可以从中删除有问题的软件包requirements.txt,在新的 上运行 conda .txt,然后将未安装的软件包安装pip到您的Anaconda/pkgs(或在安装后手动将它们移到那里)。然后,运行conda update --all以确保兼容性。

在类似的情况下为我工作。


推荐阅读