49

I'm learning to setup python environments using conda, and I noticed that on the anaconda cloud website they recommend installing packages using the sintax

conda install -c package

However on the conda documentation they use the same command without the c flag.

Could anyone explain to me what is the purpose of the c flag and when should it be used?

Alessandro Messori
  • 1,035
  • 1
  • 14
  • 23

2 Answers2

43

-c stands for --channel. It's used to specify a channel where to search for your package, the channel is often named owner.

The generic command is: conda install -c CHANNEL_NAME PACKAGE_NAME

For example, let's say you want to download pytorch. You can search on anaconda.org. You'll see that pytorch (the pacakge) is owned by pytorch.

enter image description here

Then, you'll just have to do a:

conda install -c pytorch pytorch

RobinFrcd
  • 4,439
  • 4
  • 25
  • 49
15

Copied from CLI after running conda install -h:

-c CHANNEL, --channel CHANNEL

Additional channel to search for packages. These are URLs searched in the order they are given (including file:// for local directories). Then, the defaults or channels from .condarc are searched (unless --override-channels is given). You can use 'defaults' to get the default packages for conda, and 'system' to get the system packages, which also takes .condarc into account. You can also use any name and the .condarc channel_alias value will be prepended. The default channel_alias is http://conda.anaconda.org/.

Channels are locations where Navigator and conda look for packages. (source) A package with the same name may exist on multiple channels. If you wish to install from other than the default channel, than one way of specifying which channel to use, is to use the conda install -c channel_name package_name syntax. Also read this for a description of install process using channels.

handras
  • 1,548
  • 14
  • 28