Presented by: Jordan Hayes (HPCC)
Create the file ~/.condarc
in your home, with the following content:
channels:
- defaults
pkgs_dirs:
- ~/bigdata/.conda/pkgs
envs_dirs:
- ~/bigdata/.conda/envs
auto_activate_base: false
https://hpcc.ucr.edu/manuals/hpc_cluster/package_manage/#virtual-environments
First, lets request a compute node, since running on the head nodes would be slow:
srun -p short -c 2 --mem=10g --pty bash -l
Create conda virtual environment for pandasEnv
, since pandas is a python pacakge, we will pre install Python:
conda create -y -n pandasEnv python=3.6.4
Activate pandasEnv virtual environment:
conda activate pandasEnv
Now that we have a virtual environment, we can install packages within it. Visit anaconda website to search for a pagckage:
After you find the package, click on the name of the package to see install command.
#conda install -y -c anaconda pandas
conda install -y -n pandasEnv -c anaconda pandas
Same proceedure as before:
fastqcEnv
virtual environmentfastqcEnv
virtual environmentfastqc
on Anacondafastqc
packagefastqcEnv
virtual environment# Create virutal environment
conda create -y -n fastqcEnv
# Activate virutal environment
conda activate fastqcEnv
# Install fastqc
conda install -y -c bioconda fastqc
# Deactivate virtual environment
conda deactivate
Same proceedure as before:
tensorflowEnv
virtual environmenttensorflowEnv
virtual environmenttensorflow
on Anacondatensorflow
packagetensorflowEnv
virtual environment# Create virtual environment
conda create -y -n tensorflowEnv
# Activate virtual environment
conda activate tensorflow
# Install tensorflow
conda install -y -n tensorflowEnv -c conda-forge tensorflow
# Deactivate virtual environment
conda deactivate
After the installs have completed, you may want to use 1 (or more) conda virtual environments within a job/script:
#!/bin/bash -l
#SBATCH -p short
#SBATCH -c 2
#SBATCH --mem=10gb
#SBATCH --time=10:00
#SBATCH -J "Conda Demo"
# Already loaded by default
module load miniconda2
#### pandasEnv ####
# Activate virtual environment
conda activate pandasEnv
# Show file path to where pandas is installed
python -c 'import pandas; print(pandas.__file__)'
# Deactivate virtual environment
conda deactivate
#### fastqcEnv ####
# Activate virtual environment
conda activate fastqcEnv
# Run help
fastqc --help
# Deactivate virtual environment
conda deactivate
#### tensorflowEnv ####
# Activate virtual environment
conda activate tensorflowEnv
# Add a scalar and a list
python -c 'import tensorflow as tf; x = [1, 2, 3, 4, 5]; y = 1; print(tf.add(x, y))'
# Deactivate virtual environment
conda deactivate