问题
I am trying to install fastai but I don't understand what they are trying to do with conda install
.
The man page of fastai
says:
conda install -c fastai -c pytorch -c anaconda fastai gh anaconda
Does this mean: the channels to be used are fastai
, pytorch
and anaconda
while the packages to be installed are fastai
, gh
and anaconda
respectively? I think they want to install pytorch
and fastai
basically. But they don't even mention pytorch
package.
conda install
seems to be done like this:
conda install -c <package-name>
回答1:
Yes, that's pretty much it. I would translate the command
conda install -c fastai -c pytorch -c anaconda fastai gh anaconda
as the imperative sentence
While prioritizing the Anaconda Cloud channels fastai, pytorch, and anaconda, in that order, ensure that the current environment has some version of each of the packages
fastai
,gh
, andanaconda
installed.
Channels tell Conda where to search for packages, and the order gives priority (first > last). Since URLs are not given, but only channel names (e.g., pytorch
), Conda will assume these channels are hosted on Anaconda Cloud (e.g., PyTorch channel). Everything that is not parseable as an option (e.g., -c
) or an argument to an option (pytorch
) is interpreted as a package to be installed (e.g., gh
).
PyTorch
As for pytorch
not being mentioned, it is listed as a dependency of the fastai
package:
$ conda search --info -c fastai fastai=2.0.13
Loading channels: done
fastai 2.0.13 py_0
------------------
file name : fastai-2.0.13-py_0.tar.bz2
name : fastai
version : 2.0.13
build : py_0
build number: 0
size : 141 KB
license : Apache Software
subdir : noarch
url : https://conda.anaconda.org/fastai/noarch/fastai-2.0.13-py_0.tar.bz2
md5 : bca97ff1932c61aeed960d9cd8dea9fc
timestamp : 2020-09-17 04:24:42 UTC
dependencies:
- fastcore >=1.0.5
- fastprogress >=0.2.4
- matplotlib
- packaging
- pandas
- pillow
- pip
- python
- pytorch >=1.6.0
- pyyaml
- requests
- scikit-learn
- scipy
- spacy
- torchvision >=0.7
so it doesn't need an explicit specification in the installation command.
Minimal Environment
I would note that unless you need the full Anaconda distribution in the environment, I would instead encourage using a more minimal installation and keep it in a dedicated environment, e.g.,
conda create --name my_fastai_env -c fastai -c pytorch -c anaconda fastai
which will still provide everything in fastai
, without all the extra packages that come by default in the anaconda
metapackage.
来源:https://stackoverflow.com/questions/64056502/understanding-conda-install-channel-and-packages