![](/img/trans.png)
[英]Update package in conda-forge, when uploader is “conda-forge”
[英]Conda can't install packages from requirements.txt available in conda-forge, although package exists in conda-forge
我将 conda-forge 添加到 conda 频道:
$ conda config --show channels
channels:
- conda-forge
- defaults
我的 requirements.txt 包含以下几行:
ipython-genutils==0.2.0
jupyter-client==6.1.12
jupyterlab-pygments==0.1.2
appnope==0.1.2
jupyterlab-widgets==1.0.0
data==0.4
prometheus-client==0.11.0
latex==0.7.0
scipy==1.5.4
jupyter-core==4.7.1
jupyter-console==6.4.0
async-generator==1.10
vg==1.10.0
sklearn==0.0
postgis==1.0.4
当我尝试使用 conda 从此 requirements.txt 创建一个新环境时
conda create --name myenv --file requirements.txt
我收到以下错误:
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- ipython-genutils==0.2.0
- jupyter-client==6.1.12
- jupyterlab-pygments==0.1.2
- appnope==0.1.2
- jupyterlab-widgets==1.0.0
- data==0.4
- prometheus-client==0.11.0
- latex==0.7.0
- scipy==1.5.4
- jupyter-core==4.7.1
- jupyter-console==6.4.0
- async-generator==1.10
- vg==1.10.0
- sklearn==0.0
- postgis==1.0.4
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-forge 列在“当前频道”下,并且ipython-genutils==0.2.0 在 conda-forge 中可用。 但是,找不到 package。 我该如何解决这个问题?
我尝试了conda config --set channel_priority flexible
和... stable
我运行 Ubuntu 20.04 LTS、Python 3.10 和 Conda 4.12.0
在我看来,这应该是 pip 使用的 requirements.txt。请注意, conda
包的名称可能与 pypi 上的名称略有不同。
ipython-genutils
不是正确的名称,查看您提供的链接,package 的名称是带下划线的ipython_genutils
。 对于您用连字符编写的其他包也是如此。 它们都应该用下划线拼写。
那留下
- sklearn==0.0
- latex==0.7.0
- vg==1.10.0
- scipy==1.5.4
- postgis==1.0.4
- data==0.4
- appnope==0.1.2
sklearn==0.0
似乎是您文件中的损坏行。 包的名称是scikit-learn
。 latex
,据我所知, vg
和data
在 conda 频道上不可用。 scipy==1.5.4
一样,只有 1.5.3 和 1.6 可用。 postgis
仅在 conda-forge 上返回到 2.4.3,请参见此处,但似乎也与 pypi 上可用的不同。 appnope
是一个仅适用于 macOS 的 package,请参阅它的说明:
简单的 package 用于在 macOS >= 10.9 上禁用 App Nap,这可能会有问题。
因此,考虑到这一点,我们可以创建一个从 conda 通道和 pip 安装的 yml 文件(对文件的更改:替换为-
,删除_
,添加pip
依赖appnope
,将 sklearn 重命名为sklearn
并将其与scikit-learn
一起latex
, scipy
, vg
, data
, postgis
到pip
要求。如果你对scipy==1.5.4
很灵活,我建议将其更改为scipy==1.5.3
或scipy==1.6.0
并移动scipy
和sklearn
pip
安装包):
name: myenv
dependencies:
- ipython_genutils==0.2.0
- jupyter_client==6.1.12
- jupyterlab_pygments==0.1.2
- jupyterlab_widgets==1.0.0
- prometheus_client==0.11.0
- jupyter_core==4.7.1
- jupyter_console==6.4.0
- async_generator==1.10
- pip
- pip:
- scikit-learn
- latex==0.7.0
- scipy==1.5.4
- vg==1.10.0
- data==0.4.0
- postgis==1.0.4
将其保存为environment.yml
然后执行
conda env create -f environment.yml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.