Hprc banner tamu.png

SW:Miniconda

From TAMU HPRC
Jump to: navigation, search

Description

You can create your own personal conda environment using miniconda which you can use to install conda and bioconda packages.

You can install software that supports conda/bioconda installation inside the conda environment you create.

Once you create a conda environment, you can continue to install other packages into that environment.

You can create more than one environment in case you need specific versions of tools.

Relocate the default install directory

By default, miniconda will save environments in your $HOME/.conda directory but since space is limited in your $HOME directory, you will either need to move your $HOME/.conda directory to $SCRATCH or specify the full path of your miniconda environment.

cd
mv .conda $SCRATCH
ln -s $SCRATCH/.conda

Create a new conda environment

Once you have moved your .conda directory to $SCRATCH, you can create a new environment.

module purge
module load Miniconda3/4.7.10
conda create -n my_miniconda_env

You will see a message similar to the following, even though the location shows /home, the symlink created in the previous step will be saving the environment in $SCRATCH/.conda

Collecting package metadata (current_repodata.json): done         
Solving environment: done

## Package Plan ##

  environment location: /home/your_netid/.conda/envs/my_miniconda_env


Proceed ([y]/n)?

Hit enter which accepts the default yes indicated by [y] then you will see the following

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate my_miniconda_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

Type 'conda activate my_miniconda_env' to activate the environment and then install packages specifying versions if needed If you see a message like the following:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.

then use 'source activate my_miniconda_env' instead of conda activate.

source activate my_miniconda_env
conda install matplotlib numpy

After installing packages, type the following to exit the environment

conda deactivate

See available environments and installed packages

To see available miniconda environments (you don't need to activate an environment to see available environments):

module load Miniconda3/4.7.10
conda env list

To see what packages and versions are installed in an environment (after activating an environment):

module load Miniconda3/4.7.10
source activate my_miniconda_env
conda list

Installing specific package versions

You can specify the package version when installing packages including the Python version, either at the time of creation for the python version:

conda create -n my_miniconda_env python=3.8.2

or after sourcing an already created environment for other packages:

conda install matplotlib=3.2.1