python - PackagesNotFoundError : The following packages are not available from current channels. 如何解决?

标签 python anaconda conda

由于我是该领域的新手,所以我提出这个问题,尽管已经有一些部分答案。我不知道我的问题的具体解决方案。 我正在尝试安装依赖项来执行我的大学主管发送的代码,方法是执行

conda install --yes --filerequirements.txt

然后我收到以下错误消息:

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:

  - click-default-group==1.2.2
  - profiling==0.1.3
  - jupyter-console==6.1.0
  - mypy-extensions==0.4.3
  - tables==3.6.1
  - numpy==1.18.3
  - ipython-genutils==0.2.0
  - jupyter-core==4.6.3
  - prometheus-client==0.7.1
  - torch==1.4.0
  - torchvision==0.5.0
  - opencv-python==4.2.0.34
  - jupyter-client==6.1.2
  - valuedispatch==0.0.1
  - nbformat==5.0.5

Current channels:

  - 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
  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch 

有人建议使用 YAML 文件而不是 .txt 来解决这个问题,但我不太确定如何实现它。

最佳

编辑: requirements.txt的内容是(虽然很长):

appdirs==1.4.4
astroid==2.3.3
attrs==19.3.0
autopep8==1.5.2
backcall==0.1.0
black==19.10b0
bleach==3.1.4
certifi==2019.11.28
chardet==3.0.4
click==7.1.2
click-default-group==1.2.2
ConfigArgParse==1.2.3
configparser==5.0.0
cycler==0.10.0
Cython==0.29.17
decorator==4.4.2
deepdish==0.3.6
defusedxml==0.6.0
entrypoints==0.3
faiss-cpu==1.6.3
faiss-gpu==1.6.3
h5py==2.10.0
hdbscan==0.8.26
idna==2.9
ipykernel==5.2.0
ipython==7.13.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
isort==4.3.21
jedi==0.16.0
Jinja2==2.11.1
joblib==0.14.1
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.2
jupyter-console==6.1.0
jupyter-core==4.6.3
kiwisolver==1.2.0
lazy-object-proxy==1.4.3
llvmlite==0.31.0
MarkupSafe==1.1.1
matplotlib==3.2.1
mccabe==0.6.1
mistune==0.8.4
mypy==0.770
mypy-extensions==0.4.3
nbconvert==5.6.1
nbformat==5.0.5
notebook==6.0.3
numba==0.48.0
numexpr==2.7.1
numpy==1.18.3
opencv-python==4.2.0.34
pandas==1.0.3
pandocfilters==1.4.2
parso==0.6.2
pathspec==0.8.0
pexpect==4.8.0
pickleshare==0.7.5
Pillow==7.1.1
profiling==0.1.3
prometheus-client==0.7.1
prompt-toolkit==3.0.5
protobuf==3.11.3
ptyprocess==0.6.0
pycodestyle==2.5.0
Pygments==2.6.1
pylint==2.4.4
pyparsing==2.4.6
pyrsistent==0.16.0
python-dateutil==2.8.1
pytz==2019.3
PyYAML==5.3.1
pyzmq==19.0.0
qtconsole==4.7.2
QtPy==1.9.0
regex==2020.5.7
requests==2.23.0
scikit-learn==0.22.2.post1
scipy==1.4.1
seaborn==0.10.0
Send2Trash==1.5.0
six==1.14.0
tables==3.6.1
tensorboardX==2.0
terminado==0.8.3
testpath==0.4.4
toml==0.10.0
torch==1.4.0
torchvision==0.5.0
tornado==6.0.4
tqdm==4.45.0
traitlets==4.3.3
typed-ast==1.4.1
typing-extensions==3.7.4.2
umap-learn==0.3.10
urllib3==1.25.8
urwid==2.1.0
valuedispatch==0.0.1
wcwidth==0.1.9
webencodings==0.5.1
widgetsnbextension==3.5.1
wrapt==1.11.2

最佳答案

看起来需求文件中的一些包的颠覆是为 PyPi 发行版构建的,但不是 conda。此外,PyPi 的某些包名称使用破折号,但在 conda 上使用下划线。

这可以通过放松需求文件中的 subversion 并用下划线替换一些破折号来解决。

一些软件包也有不同的名称。例如,Torch 称为 pytorch。此外,您还需要包含 pytorch channel 。

最后,valuedispatch 软件包仅在 PyPi 上,并且必须使用 PIP 安装。

将需求文件替换为以下内容,然后运行以下命令:

conda install -y --file requirements.txt -c defaults -c conda-forge -c pytorch
pip install valuedispatch
pip install profiling

需求.txt:

appdirs==1.4.*
astroid==2.3.*
attrs==19.3.*
autopep8==1.5.*
backcall==0.1.*
black==19.*
bleach==3.1.*
certifi==2019.11.*
chardet==3.0.*
click==7.1.*
click-default-group==1.2.*
ConfigArgParse==1.2.*
configparser==5.0.*
cycler==0.10.*
Cython==0.29.*
decorator==4.4.*
deepdish==0.3.*
defusedxml==0.6.*
entrypoints==0.*
faiss-cpu==1.6.*
faiss-gpu==1.6.*
h5py==2.10.*
hdbscan==0.8.*
idna==2.*
ipykernel==5.2.*
ipython==7.13.*
ipython_genutils==0.2.*
ipywidgets==7.5.*
isort==4.3.*
jedi==0.16.*
Jinja2==2.11.*
joblib==0.14.*
jsonschema==3.2.*
jupyter==1.0.*
jupyter_client==6.1.*
jupyter_console==6.1.*
jupyter_core==4.6.*
kiwisolver==1.2.*
lazy-object-proxy==1.4.*
llvmlite==0.31.*
MarkupSafe==1.1.*
matplotlib==3.2.*
mccabe==0.6.*
mistune==0.8.*
mypy==0.*
mypy_extensions==0.4.*
nbconvert==5.6.*
nbformat==5.0.*
notebook==6.0.*
numba==0.48.*
numexpr==2.7.*
numpy==1.18.*
opencv==4.2.*
pandas==1.0.*
pandocfilters==1.4.*
parso==0.6.*
pathspec==0.8.*
pexpect==4.8.*
pickleshare==0.7.*
Pillow==7.1.*
prometheus_client==0.7.*
prompt_toolkit==3.0.*
protobuf==3.11.*
ptyprocess==0.6.*
pycodestyle==2.5.*
Pygments==2.6.*
pylint==2.4.*
pyparsing==2.4.*
pyrsistent==0.16.*
python-dateutil==2.8.*
pytz==2019.*
PyYAML==5.3.*
pyzmq==19.0.*
qtconsole==4.7.*
QtPy==1.9.*
regex==2020.5.*
requests==2.23.*
scikit-learn==0.22.*
scipy==1.4.*
seaborn==0.10.*
Send2Trash==1.5.*
six==1.14.*
pytables==3.6.*
tensorboardX==2.*
terminado==0.8.*
testpath==0.4.*
toml==0.10.*
pytorch==1.4.*
torchvision==0.5.*
tornado==6.0.*
tqdm==4.45.*
traitlets==4.3.*
typed-ast==1.4.*
typing-extensions==3.7.*
umap-learn==0.3.*
urllib3==1.25.*
urwid==2.1.*
wcwidth==0.1.*
webencodings==0.5.*
widgetsnbextension==3.5.*
wrapt==1.11.*

或者,您可以使用 PIP 和原始文件通过以下方式安装所有内容:

pip install -r requirements.txt

但正如 @merv 提到的,最好不要在基础环境中执行此操作。

关于python - PackagesNotFoundError : The following packages are not available from current channels. 如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65422827/

相关文章:

python - 如果我有网页上按钮的 xpath,如何在该特定元素周围放置一个框?

python - 在Windows 10 64位Python 3.6上安装pygraphviz

docker - 在 dockerfile 中运行 conda update 的问题

python - conda与caffe一起安装openCV 3.4.2,但不能单独删除

mysql - 在 Jupyter 笔记本、Conda 环境、Python 3.6 上找不到 MySQL

python - 了解虚拟环境行为

python - 类型错误 : can only assign an iterable - Values to list

python - 改进算法以找到一维 numpy 数组的局部最大值

python - 在 pandas 数据框中填充新列,该数据框从其他列获取输入

python - Conda 找不到现有的 binstar 包