Skip to content
conda-multi-account-hipergator logo

Conda Multi-Account Setup on HiPerGator

conda-multi-account-hipergator

Set up conda with multiple group storage locations on HiPerGator, including cache isolation

SKILL.md

Full skill instructions

Conda Multi-Account Setup on HiPerGator

Experiment Overview

ItemDetails
Date2026-01-11
GoalConfigure conda and ALL caches to use separate group storage locations
EnvironmentHiPerGator (UF), RHEL 9, multiple /​blue/​group/ directories
StatusSuccess

Context

On HiPerGator, users often belong to multiple research groups with separate storage allocations under /​blue/. Each group may have its own conda installation and environments. The challenge is:

  1. Switching between different group conda installations
  2. Isolating ALL caches (pip, Jupyter, PyTorch, etc.) per-group to avoid conflicts and quota issues

The Problem

  • Default conda only knows about environments in home directory or current base
  • Caches (pip, Jupyter, torch, HuggingFace, etc.) accumulate in home directory
  • With multiple accounts, caches can conflict or exceed quota
  • Hardcoding cache paths in .bashrc breaks when switching accounts

Verified Workflow

Solution: Dynamic Account Switching with Cache Isolation

Architecture:

~/​.bashrc                    # Sources default use_conda script
~/​.use_conda_maigan.sh       # Sets BLUE_BASE, sources cache_redirect.sh
~/​.use_conda_clive.sh        # Sets BLUE_BASE, sources cache_redirect.sh
~/​.cache_redirect.sh         # Uses BLUE_BASE to set all cache paths

Step 1: Create Cache Redirect Script

Create ~/​.cache_redirect.sh that uses a BLUE_BASE variable:

# ~/​.cache_redirect.sh
# BLUE_BASE must be set before sourcing this file

if [ -z "$BLUE_BASE" ]; then
    echo "Warning: BLUE_BASE not set, defaulting to maigan" >&2
    export BLUE_BASE="/​blue/​maigan/​smith6jt"
fi
export CACHE_DIR="${BLUE_BASE}/​scratch/​cache"

# Python & Pip caches
export PIP_CACHE_DIR="${CACHE_DIR}/​pip"
export PYTHONPYCACHEPREFIX="${CACHE_DIR}/​pycache"
export PYTHONDONTWRITEBYTECODE=1
export PYTHONUSERBASE="${CACHE_DIR}/​python_user"

# Jupyter & IPython
export JUPYTER_RUNTIME_DIR="${CACHE_DIR}/​jupyter_runtime"
export JUPYTER_DATA_DIR="${CACHE_DIR}/​jupyter_data"
export JUPYTER_CONFIG_DIR="${CACHE_DIR}/​jupyter_config"
export IPYTHONDIR="${CACHE_DIR}/​ipython"

# Deep Learning framework caches
export TORCH_HOME="${CACHE_DIR}/​torch"
export TORCH_EXTENSIONS_DIR="${CACHE_DIR}/​torch_extensions"
export TRANSFORMERS_CACHE="${CACHE_DIR}/​huggingface"
export HF_HOME="${CACHE_DIR}/​huggingface"
export NUMBA_CACHE_DIR="${CACHE_DIR}/​numba"

# Matplotlib & plotting
export MPLCONFIGDIR="${CACHE_DIR}/​mpl"
export MPLBACKEND="Agg"

# XDG directories (Linux standard)
export XDG_CACHE_HOME="${CACHE_DIR}/​xdg"
export XDG_CONFIG_HOME="${CACHE_DIR}/​config"
export XDG_DATA_HOME="${CACHE_DIR}/​data"

# R libraries
export R_LIBS_USER="${BLUE_BASE}/​R_libs"

# VSCode server cache
export VSCODE_SERVER_DIR="${CACHE_DIR}/​vscode-server"

# Conda paths
export CONDA_PKGS_DIRS="${BLUE_BASE}/​miniforge3/​pkgs"
export CONDA_ENVS_PATH="${BLUE_BASE}/​miniforge3/​envs"

# Create directories if they don't exist
for dir in pip pycache python_user jupyter_runtime jupyter_data jupyter_config \
           ipython torch torch_extensions huggingface numba mpl xdg config data \
           vscode-server; do
    mkdir -p "${CACHE_DIR}/​${dir}"
done
mkdir -p "${BLUE_BASE}/​R_libs"

# Confirm setup in interactive shells
if [ -n "$PS1" ]; then
    echo "✓ Cache redirection active: ${CACHE_DIR}"
fi

Step 2: Create Account-Specific Conda Scripts

For maigan account (~/​.use_conda_maigan.sh):

#!/​bin/​bash
# ~/​.use_conda_maigan.sh

# Stop any previous conda context
unset CONDA_EXE CONDA_PREFIX CONDA_SHLVL _CE_CONDA _CE_M CONDA_DEFAULT_ENV

# Set base directory FIRST
export BLUE_BASE="/​blue/​maigan/​smith6jt"

# Conda configuration
export CONDARC="${BLUE_BASE}/​.condarc"
export CONDA_ENVS_PATH="${BLUE_BASE}/​miniforge3/​envs"
export CONDA_PKGS_DIRS="${BLUE_BASE}/​miniforge3/​pkgs"

# Initialize conda
source "${BLUE_BASE}/​miniforge3/​etc/​profile.d/​conda.sh"

# Source cache redirection (uses BLUE_BASE set above)
if [ -f ~/​.cache_redirect.sh ]; then
    source ~/​.cache_redirect.sh
fi

echo "Switched to maigan conda environment"

For other accounts (e.g., ~/​.use_conda_clive.sh):

#!/​bin/​bash
# ~/​.use_conda_clive.sh

unset CONDA_EXE CONDA_PREFIX CONDA_SHLVL _CE_CONDA _CE_M CONDA_DEFAULT_ENV

export BLUE_BASE="/​blue/​clive/​smith6jt"

export CONDARC="${BLUE_BASE}/​.condarc"
export CONDA_ENVS_PATH="${BLUE_BASE}/​miniforge3/​envs"
export CONDA_PKGS_DIRS="${BLUE_BASE}/​miniforge3/​pkgs"

source "${BLUE_BASE}/​miniforge3/​etc/​profile.d/​conda.sh"

if [ -f ~/​.cache_redirect.sh ]; then
    source ~/​.cache_redirect.sh
fi

echo "Switched to clive conda environment"

Step 3: Configure .bashrc

# ~/​.bashrc

case $- in
    *i*) ;;
    *) return;;
esac

PS1='\u@\h:\w\$ '

# Aliases
alias ls='ls --color=auto'
alias ll='ls -lh --color=auto'
alias grep='grep --color=auto'

# Account switchers
alias use_clive='source ~/​.use_conda_clive.sh'
alias use_maigan='source ~/​.use_conda_maigan.sh'

# Default account on startup (sets BLUE_BASE and sources cache_redirect)
if [ -f ~/​.use_conda_maigan.sh ]; then
    source ~/​.use_conda_maigan.sh
fi

export PATH="$HOME/​.local/​bin:$PATH"

# NVM (uses BLUE_BASE dynamically)
if [ -n "$BLUE_BASE" ]; then
    export NVM_DIR="${BLUE_BASE}/​scratch/​cache/​config/​nvm"
    [ -s "$NVM_DIR/​nvm.sh" ] && \. "$NVM_DIR/​nvm.sh"
fi

Step 4: Clean Up environments.txt

Remove other accounts' environments from ~/​.conda/​environments.txt:

# Only include environments from your primary account
/​blue/​maigan/​smith6jt/​miniforge3
/​blue/​maigan/​smith6jt/​miniforge3/​envs/​KINTSUGI

Usage

# Start of session - already using maigan (default from .bashrc)
conda env list
# Shows only maigan environments

# Switch to different account
use_clive
# Switches conda AND redirects all caches to /​blue/​clive/​...

# Check cache location
echo $CACHE_DIR
# /​blue/​clive/​smith6jt/​scratch/​cache

# Switch back
use_maigan

Failed Attempts (Critical)

AttemptWhy it FailedLesson Learned
Sourcing cache_redirect AFTER use_conda in .bashrcOverwrites conda paths with hardcoded valuescache_redirect must be called BY use_conda scripts
Hardcoding cache paths in .bashrcDoesn't switch when changing accountsUse BLUE_BASE variable
Adding both accounts' envs to CONDA_ENVS_DIRSConfusing, shows all envs from both accountsKeep environments isolated per-account
Using CONDA_ENVS_DIRS colon-separated listFirst path becomes default for new envs, unexpected behaviorUse CONDA_ENVS_PATH (single path)

Key Insights

  • Set BLUE_BASE FIRST, then source cache_redirect
  • Cache redirect script should use the variable, never hardcode paths
  • .bashrc should NOT separately source cache_redirect - let use_conda scripts handle it
  • Clean ~/​.conda/​environments.txt to avoid confusion
  • Each /​blue/​group/ needs its own .condarc file
  • Create cache directories (/​blue/​group/​user/​scratch/​cache/) for each account

Directory Structure

/​blue/​maigan/​smith6jt/
├── miniforge3/
│   ├── etc/​profile.d/​conda.sh
│   ├── envs/​KINTSUGI/
│   └── pkgs/
├── scratch/​cache/          # All caches for this account
│   ├── pip/
│   ├── torch/
│   ├── jupyter_runtime/
│   └── ...
└── .condarc

/​blue/​clive/​smith6jt/
├── miniforge3/
│   ├── envs/
│   └── pkgs/
├── scratch/​cache/          # All caches for this account
└── .condarc

~/
├── .bashrc                 # Sources default use_conda script
├── .use_conda_maigan.sh    # Account switcher
├── .use_conda_clive.sh     # Account switcher
├── .cache_redirect.sh      # Dynamic cache paths (uses BLUE_BASE)
└── .conda/​environments.txt # Clean - only default account

References

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View