Last active
June 6, 2026 17:47
-
-
Save Praful932/246173142223a0495565dcb7b163ab5d to your computer and use it in GitHub Desktop.
Runpod env setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # ============================================================ | |
| # RunPod Setup: Miniconda + Poetry | |
| # Image: runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04 | |
| # | |
| # Container start command (outer): | |
| # bash -c 'curl -fsSL https://gist.githubusercontent.com/YOUR_GIST/run_pod_setup.sh | bash && /start.sh' | |
| # ============================================================ | |
| CONDA_DIR="$HOME/miniconda3" | |
| # Step 1: Install Miniconda (skip if already present) | |
| if [ ! -x "$CONDA_DIR/bin/conda" ]; then | |
| echo ">>> Installing Miniconda..." | |
| mkdir -p "$CONDA_DIR" | |
| wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O "$CONDA_DIR/miniconda.sh" | |
| bash "$CONDA_DIR/miniconda.sh" -b -u -p "$CONDA_DIR" | |
| rm -f "$CONDA_DIR/miniconda.sh" | |
| else | |
| echo ">>> Miniconda already installed, skipping." | |
| fi | |
| # Step 2: Put conda on PATH for this script and enable `conda activate` | |
| export PATH="$CONDA_DIR/bin:$PATH" | |
| source "$CONDA_DIR/etc/profile.d/conda.sh" | |
| # Step 3: Accept Conda ToS | |
| conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main | |
| conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r | |
| # Step 4: Install Poetry (skip if already present) | |
| if [ ! -x "$HOME/.local/share/pypoetry/venv/bin/poetry" ]; then | |
| echo ">>> Installing Poetry..." | |
| curl -sSL https://install.python-poetry.org | python3 - | |
| else | |
| echo ">>> Poetry already installed, skipping." | |
| fi | |
| export PATH="$HOME/.local/share/pypoetry/venv/bin:$PATH" | |
| # Step 5: Configure Poetry (only the setting that exists on your version) | |
| poetry config virtualenvs.in-project true | |
| # Step 6: Persist PATH + conda to ~/.bashrc (idempotent) | |
| if ! grep -q "RunPod: Conda + Poetry" ~/.bashrc 2>/dev/null; then | |
| cat >> ~/.bashrc << 'EOF' | |
| # ── RunPod: Conda + Poetry ─────────────────────────────────── | |
| export PATH="$HOME/miniconda3/bin:$HOME/.local/share/pypoetry/venv/bin:$PATH" | |
| source "$HOME/miniconda3/etc/profile.d/conda.sh" | |
| # ───────────────────────────────────────────────────────────── | |
| EOF | |
| fi | |
| echo "" | |
| echo "Setup complete." | |
| echo "Workflow:" | |
| echo " conda create -n myenv python=3.11 -y" | |
| echo " conda activate myenv" | |
| echo " poetry env use \$(which python) # points Poetry to conda's Python" | |
| echo " poetry install" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment