|
| 1 | +#!/bin/bash |
| 2 | +# PyTorch Connectomics Quick Start Installation |
| 3 | +# Works on most systems with CUDA 11+ or CPU-only |
| 4 | +# |
| 5 | +# Usage: |
| 6 | +# bash quickstart.sh |
| 7 | +# curl -fsSL https://raw.githubusercontent.com/zudi-lin/pytorch_connectomics/v2.0/quickstart.sh | bash |
| 8 | + |
| 9 | +set -e |
| 10 | + |
| 11 | +# Colors |
| 12 | +RED='\033[0;31m' |
| 13 | +GREEN='\033[0;32m' |
| 14 | +YELLOW='\033[1;33m' |
| 15 | +BLUE='\033[0;34m' |
| 16 | +BOLD='\033[1m' |
| 17 | +NC='\033[0m' # No Color |
| 18 | + |
| 19 | +# Print functions |
| 20 | +print_header() { |
| 21 | + echo -e "\n${BOLD}${BLUE}========================================${NC}" |
| 22 | + echo -e "${BOLD}${BLUE}$1${NC}" |
| 23 | + echo -e "${BOLD}${BLUE}========================================${NC}\n" |
| 24 | +} |
| 25 | + |
| 26 | +print_success() { |
| 27 | + echo -e "${GREEN}✓${NC} $1" |
| 28 | +} |
| 29 | + |
| 30 | +print_error() { |
| 31 | + echo -e "${RED}✗${NC} $1" |
| 32 | +} |
| 33 | + |
| 34 | +print_warning() { |
| 35 | + echo -e "${YELLOW}⚠${NC} $1" |
| 36 | +} |
| 37 | + |
| 38 | +print_info() { |
| 39 | + echo -e "${BLUE}ℹ${NC} $1" |
| 40 | +} |
| 41 | + |
| 42 | +# Main installation |
| 43 | +main() { |
| 44 | + print_header "🚀 PyTorch Connectomics Quick Start" |
| 45 | + |
| 46 | + # Check if conda exists |
| 47 | + if ! command -v conda &> /dev/null; then |
| 48 | + print_warning "conda not found. Installing Miniconda..." |
| 49 | + |
| 50 | + # Download Miniconda |
| 51 | + MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" |
| 52 | + MINICONDA_INSTALLER="/tmp/miniconda.sh" |
| 53 | + |
| 54 | + curl -fsSL "$MINICONDA_URL" -o "$MINICONDA_INSTALLER" |
| 55 | + bash "$MINICONDA_INSTALLER" -b -p "$HOME/miniconda3" |
| 56 | + rm "$MINICONDA_INSTALLER" |
| 57 | + |
| 58 | + # Add to PATH |
| 59 | + export PATH="$HOME/miniconda3/bin:$PATH" |
| 60 | + |
| 61 | + # Initialize conda for bash |
| 62 | + eval "$($HOME/miniconda3/bin/conda shell.bash hook)" |
| 63 | + |
| 64 | + print_success "Miniconda installed" |
| 65 | + else |
| 66 | + print_success "conda found" |
| 67 | + fi |
| 68 | + |
| 69 | + # Clone repo if not already in it |
| 70 | + if [ ! -f "setup.py" ]; then |
| 71 | + print_info "Cloning PyTorch Connectomics repository..." |
| 72 | + git clone https://github.com/zudi-lin/pytorch_connectomics.git |
| 73 | + cd pytorch_connectomics |
| 74 | + print_success "Repository cloned" |
| 75 | + else |
| 76 | + print_success "Already in PyTorch Connectomics directory" |
| 77 | + fi |
| 78 | + |
| 79 | + # Run automated installer (non-interactive, basic mode) |
| 80 | + print_info "Running automated installation..." |
| 81 | + python install.py --install-type basic |
| 82 | + |
| 83 | + # Print completion message |
| 84 | + print_header "✅ Installation Complete!" |
| 85 | + |
| 86 | + echo -e "${GREEN}${BOLD}PyTorch Connectomics is ready to use!${NC}\n" |
| 87 | + |
| 88 | + echo -e "${BOLD}Next steps:${NC}" |
| 89 | + echo -e " 1. Activate the environment:" |
| 90 | + echo -e " ${BOLD}conda activate pytc${NC}\n" |
| 91 | + |
| 92 | + echo -e " 2. Run a quick demo (30 seconds):" |
| 93 | + echo -e " ${BOLD}python scripts/main.py --demo${NC}\n" |
| 94 | + |
| 95 | + echo -e " 3. Try a tutorial (mitochondria segmentation):" |
| 96 | + echo -e " ${BOLD}python scripts/main.py --config tutorials/lucchi.yaml --fast-dev-run${NC}\n" |
| 97 | + |
| 98 | + echo -e "${BOLD}Need help?${NC}" |
| 99 | + echo -e " 📚 Documentation: https://connectomics.readthedocs.io" |
| 100 | + echo -e " 💬 Slack: https://join.slack.com/t/pytorchconnectomics/shared_invite/zt-obufj5d1-v5_NndNS5yog8vhxy4L12w" |
| 101 | + echo -e " 🐛 Issues: https://github.com/zudi-lin/pytorch_connectomics/issues\n" |
| 102 | +} |
| 103 | + |
| 104 | +# Run main function |
| 105 | +main |
0 commit comments