2

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>
agent18
  • 2,109
  • 4
  • 20
  • 34

1 Answers1

2

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, and anaconda 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.

merv
  • 67,214
  • 13
  • 180
  • 245
  • Finally some clarity. Thank you very much. One small follow up: why am I supposed to install `anaconda`? Don't I have `anaconda` already? To use `conda install` you need `anaconda` don't you? @merv – agent18 Sep 25 '20 at 02:03
  • 1
    @ThejKiran Conda (the package and environment manager) is distinct from Anaconda, which is a distribution of a bunch of common data science tools and includes the `conda` package. I'm not entirely clear on the motivation for including `anaconda` package. The docs seem to conflate having an Anaconda base installed with always wanting to install `anaconda` (unlikely), and a Miniconda base with not wanting `anaconda` (usually true). Since both include Conda, both allow bespoke environments with or without `anaconda`. Perhaps it is a safeguard to make sure `anaconda` updates? – merv Sep 25 '20 at 02:15
  • so you are saying that installing `anaconda` the package might not be necessary as the `miniconda` installation does not require `anaconda` the package? – agent18 Sep 25 '20 at 02:19
  • 1
    The `anaconda` package is not required to install `fastai`, whether you have an Anaconda or Miniconda **base**. The "Minimal Environment" I suggest is what I regard as a better practice than the commands they suggest. However, beginners often want everything installed by default, and so may prefer including `anaconda`. – merv Sep 25 '20 at 02:29
  • 1
    **A note:** Installing fastai and pytorch in the already installed anaconda seems to raise so many conflicts (which I do not know how to handle). Going with the minimalistic approach got me 0 error or warning messages. :) – agent18 Sep 25 '20 at 08:42