wiki:cypress/AnacondaInstallPackage

Version 4 (modified by hoang, 7 years ago) ( diff )

Install Packages to Anaconda Python

For this example, we assume you have loaded the "anaconda3/5.1.0", but you can use another version if you want.

module load anaconda3/5.1.0

'conda' is the command to add packages to Anaconda python distribution. However, since you don't have a permission in /share/apps/anaconda, it won't work. There is a workaround. Here, for example, we want to add 'vtk' python wrapper library. You try:

conda install vtk

But you will see an error message with an instruction for the workaround. Following the instruction, you have to clone the python environment. By default, your conda environments are located in your home directory. But, we recommend you to use your group project directory. Setting the CONDA_ENVS_PATH environment variable will tell Anaconda where to place and look for your conda environments. For example:

export CONDA_ENVS_PATH=/lustre/project/mygroup/myuser/conda-envs

will put your conda environments at the folder /lustre/project/mygroup/myuser/conda-envs (you may have to create this folder if it does not exist).

Then, you can create a new personal conda environment:

conda create -n my_root python

'my_root' is the name of environment that you decide. Then,

source activate my_root

Finally, you can install the package,

conda install vtk

In case you encounter "Error: 'conda' can only be installed into the root environment", try

conda remove conda-build
conda remove conda-env
conda install vtk

From next time, to use Anaconda python with your environment,

module load anaconda3/5.1.0
export CONDA_ENVS_PATH=/lustre/project/mygroup/myuser/conda-envs
source activate my_root

You have to state above commands in your script when you run python on batch jobs.

Note: See TracWiki for help on using the wiki.