Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 51 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ set -euo pipefail
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m'

log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1";}

# Configuration
PYTORCH_VERSION="2.9.0.dev20250828"
Expand All @@ -34,22 +36,67 @@ check_conda_env() {
log_info "Installing in conda environment: $CONDA_DEFAULT_ENV"
}

# Check sudo access
check_sudo() {
# Check sudo access only
check_sudo_only() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove this and install_systems_packages_sudo_only?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @allenwang28 for quickly review that. Just removed those two _only functions from the script.

if ! sudo -n true 2>/dev/null; then
log_error "This script requires passwordless sudo access for system packages"
log_info "Run 'sudo -v' first, or configure passwordless sudo"
exit 1
fi
}

# Check sudo access and if it is not available; continue with Conda
check_sudo() {
if ! sudo -n true 2>/dev/null; then
log_warning "Passwordless sudo access is not available."
log_info "The script will continue and attempt to install packages via conda instead."
else
log_info "Passwordless sudo access detected."
fi
}

# Install required system packages
install_system_packages() {
install_system_packages_sudo_only() {
log_info "Installing required system packages..."
sudo dnf install -y libibverbs rdma-core libmlx5 libibverbs-devel rdma-core-devel
log_info "System packages installed successfully"
}

# Install required system packages
install_system_packages() {
log_info "Installing required system packages..."
# Check for sudo access
if sudo -n true 2>/dev/null; then
# Detect OS and install packages accordingly
if [ -f /etc/fedora-release ]; then
log_info "Detected Fedora OS"
sudo dnf install -y libibverbs rdma-core libmlx5 libibverbs-devel rdma-core-devel
elif [ -f /etc/lsb-release ] || [ -f /etc/ubuntu-release ]; then
log_info "Detected Ubuntu OS"
sudo apt-get update
sudo apt-get install -y libibverbs1 rdma-core libmlx5-1 libibverbs-dev rdma-core-dev
else
log_error "Unsupported OS for automatic system package installation"
exit 1
fi
log_info "System packages installed successfully"
else
log_warning "No sudo access detected. Attempting to install packages via conda."
conda install -c conda-forge rdma-core libibverbs-cos7-x86_64 -y
log_info "Conda package installation attempted. Please ensure the packages are installed correctly."
fi
}

# Check to see if gh is installed, if not, it will be installed via conda-forge channel
check_gh_install() {
if ! command -v gh &> /dev/null; then
log_warning "GitHub CLI (gh) not found. Installing via Conda..."
conda install gh --channel conda-forge -y
else
log_info "GitHub CLI (gh) already installed."
fi
}

# Check wheels exist
check_wheels() {
if [ ! -d "$WHEEL_DIR" ]; then
Expand Down Expand Up @@ -126,6 +173,7 @@ main() {
conda install -y openssl

install_system_packages
check_gh_install
download_vllm_wheel

log_info "Installing PyTorch nightly..."
Expand Down
Loading