Modify a conda environment¶
Commands conda install and conda remove are available for this purpose
Additional resources
How to add a package?¶
This can be done by using the conda install <pkg1> <pkg2> ... command.
Example
How to install or to update a package to a specific version?¶
You can use the notations =, ==, !=, <=, <, >= and > to target a package version.
Examples
-
Install the last
python 2version in an existing environment:# We activate the environment where we want to add package(s)source activate <env># We install the last python before the version 3 (i.e. python 2.x.y)conda install "python<3"...# We check the python versionconda list# packages in environment at <env>:# # Name Version Build Channel...
python 2.7.15 h5a48372_1011_cpython conda-forge
... -
Install
numpybetween version 1.22.0 included and 1.22.3 excluded:source activate <env>conda install "numpy>=1.22,<1.22.3"...conda list# packages in environment at <env>:# # Name Version Build Channel...
numpy 1.22.2 py310h454958d_0 conda-forge
...
Danger
Be sure to use " when using > and <.
How to uninstall a package?¶
You must use the command conda remove:
How to use a specific channel?¶
Sometime, a package is available in a channel you haven't configured. You can use option -c or --channel to install it without altering your conda configuration.
Conda create
This option can also be used with the conda create command.
Example
Install DESeq2 from bioconda channel and R, its dependency provided by conda-forge channel.
Channel priority
The further to the left of the command the channel appears, the lower its priority: conda-forge channel has priority over bioconda if a package exists in both channels.