Anaconda: Difference between revisions
From Leo's Notes
This page was last edited on 19 May 2020, at 17:30.
m →Usage |
No edit summary |
||
| Line 55: | Line 55: | ||
|} | |} | ||
== | == Tasks == | ||
=== Setup an R environment === | |||
To create and install a particular package in a new environment, such as R: | To create and install a particular package in a new environment, such as R: | ||
{{highlight|lang=terminal|code= | {{highlight|lang=terminal|code= | ||
| Line 66: | Line 67: | ||
(base) $ conda deactivate | (base) $ conda deactivate | ||
}} | }} | ||
=== Setup R Bioconda === | |||
To get Bioconda working, you will need to add the following channels first: | |||
{{highlight|lang=terminal|code= | |||
$ conda config --add channels defaults | |||
$ conda config --add channels bioconda | |||
$ conda config --add channels conda-forge | |||
}} | |||
Once that is done, you can then install packages such as: | |||
{{highlight|lang=terminal|code= | |||
$ conda install r-metaboanalyst | |||
}} | |||
Missing channels will result in a conflict and an empty UnsatisfiableError failure: | |||
{{highlight|lang=text|code= | |||
(rlang) ~ % conda create -n rmetabo -c bioconda r-metaboanalyst | |||
Collecting package metadata (current_repodata.json): done | |||
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. | |||
Collecting package metadata (repodata.json): done | |||
Solving environment: / | |||
Found conflicts! Looking for incompatible packages. | |||
This can take several minutes. Press CTRL-C to abort. | |||
failed | |||
UnsatisfiableError: | |||
}} | |||
== See Also == | == See Also == | ||
* https://linuxize.com/post/how-to-install-anaconda-on-centos-7/ | * https://linuxize.com/post/how-to-install-anaconda-on-centos-7/ | ||
Revision as of 17:30, 19 May 2020
Installation
$ wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
$ bash Anaconda3*sh
Do you wish the installer to initialize Anaconda3
in your /gpfs/home/lleung/.bashrc ? [yes|no]
[no] >>> yes
Once installed, you will need to initialize and set up conda for your shell.
$ conda init zsh
## Restart or exec your shell
$ exec zsh
## If loaded properly, your shell should have a prefix of the environment name. Defaults to 'base'
(base) $
Usage
| Command | Description |
|---|---|
| conda create -n env_name pip python=version | env_name is the name of the new environment. Packages follow. |
| conda env [-n] list | Lists environments. -n lists deactivated environments. |
| conda list | Environment currently activated |
| conda info –envs | View list of packages installed on certain environment: |
| conda list -n env_name package_name | See if a certain package is installed. |
| conda activate env_name | Activates an environment |
| conda deactivate | Exit from an environment |
| conda env remove -n env_name | Removes an environment |
Tasks
Setup an R environment
To create and install a particular package in a new environment, such as R:
$ conda create -n mro_env r-essentials
$ conda activate mro_env
To deactivate, run:
(base) $ conda deactivate
Setup R Bioconda
To get Bioconda working, you will need to add the following channels first:
$ conda config --add channels defaults
$ conda config --add channels bioconda
$ conda config --add channels conda-forge
Once that is done, you can then install packages such as:
$ conda install r-metaboanalyst
Missing channels will result in a conflict and an empty UnsatisfiableError failure:
(rlang) ~ % conda create -n rmetabo -c bioconda r-metaboanalyst
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: