Skip to content

Instantly share code, notes, and snippets.

@juvi21
Last active June 27, 2025 13:01
Show Gist options
  • Select an option

  • Save juvi21/3ada5444982d68737569ef5d1a5fb9b8 to your computer and use it in GitHub Desktop.

Select an option

Save juvi21/3ada5444982d68737569ef5d1a5fb9b8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
# 1) Download & install CUDA toolkit repo
CUDA_PKG="cuda-repo-ubuntu2204-12-8-local_12.8.0-570.86.10-1_amd64.deb"
CUDA_URL="https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/$CUDA_PKG"
echo "Downloading CUDA package..."
wget -q "$CUDA_URL" -O "/tmp/$CUDA_PKG"
echo "Installing CUDA repository package..."
dpkg -i "/tmp/$CUDA_PKG"
echo "Adding CUDA GPG key..."
cp /var/cuda-repo-ubuntu2204-12-8-local/12.8.0-570.86.10-1/ubuntu2204/*keyring.gpg /usr/share/keyrings/
# 2) Update APT and install CUDA toolkit + dev packages
echo "Updating apt & installing CUDA toolkit and Python dev packages..."
apt-get update -qq
apt-get install -y --no-install-recommends \
cuda-toolkit-12-8 \
python3.10-venv \
python3.10-dev \
nano \
ca-certificates \
wget
# 3) Clean up APT cache to save space
apt-get clean
rm -rf /var/lib/apt/lists/* "/tmp/$CUDA_PKG"
# 4) Create & activate Python venv
echo "Creating Python venv in ./venv..."
python3.10 -m venv venv
# shellcheck disable=SC1091
source venv/bin/activate
echo "Upgrading pip..."
pip install --upgrade pip
sudo apt install nodejs -y
sudo apt install npm
npm i @anthropic-ai/claude-code
# 6) Install PyTorch with CUDA support
echo "Installing PyTorch/cu128..."
pip install --upgrade \
torch torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu128
echo
echo "✅ Done! To start using your venv, run:"
echo " source venv/bin/activate"
echo
echo "You can now use the Anthropic client in Python, e.g.:"
echo " from anthropic import Client"
echo " client = Client(api_key='YOUR_API_KEY')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment