問題描述
我嘗試了多種方法,但無法 conda 安裝軟件包(在我的例子中是 geopandas).我嘗試了 geopandas 安裝指南,但得到了求解器永遠運行的輸出.在創建新環境后,我嘗試不創建環境,使用 defaults 頻道并使用 conda-forge 頻道.沒有任何效果.
I have tried multiple ways but can't conda install packages (in my case, geopandas). I tried geopandas install guide, but get output that the solver runs forever. I tried without creating an environment, after creating a new environment, using defaults channel and using conda-forge channel. None worked.
$ conda create -n top
$ conda activate top
$ conda config --env --add channels conda-forge
$ conda config --env --set channel_priority strict
$ conda install python=3 geopandas
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment:
我不想使用 pip install
,因為我更喜歡使用 conda install
.我還嘗試按照 this answer 使用 Anaconda Navigator 進行安裝,但進度條保持不變運行說解決包規范.
I don't want to use pip install
because it is preferred to use conda install
.
Also I tried installing using Anaconda Navigator following this answer, but the progress bar keeps running saying solving package specifications.
推薦答案
支持在創建時指定約束
迭代安裝包是 Conda 的真正瓶頸.如果您事先知道 env 需要某些包,請在創建時指定它們:
Favor Specifying Constraints at Creation
Iteratively installing packages is a real choking point for Conda. If you know up front that the env will require certain packages, then specify them at creation:
conda create -n top -c conda-forge -c defaults python=3 geopandas
這對我來說在幾秒鐘內就解決了.如果你有很多包,那么 使用 YAML.
This solves in seconds for me. If you have many packages, then use a YAML.
有時臨時安裝是不可避免的.對于棘手的解決方案(或一般情況下),嘗試使用 mamba
, conda
的已編譯(快速!)替代品.曼巴將在康達掙扎的地方大放異彩.
Sometimes ad hoc installations are unavoidable. For tough solves (or just generally), try using mamba
, a compiled (fast!) drop-in replacement for conda
. Mamba will shine where Conda struggles.
# install mamba
conda install -n base conda-forge::mamba
# use mamba
mamba install -n top geopandas
這篇關于Conda install some-package 掛起(解決環境:失敗)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!