githubEdit

WSL Installation

This guide covers setting up Google Gemini on Windows Subsystem for Linux (WSL2), providing a Linux environment on Windows systems for DevOps professionals.

Prerequisites

  • Windows 10 version 2004+ or Windows 11

  • WSL2 installed and configured

  • A Linux distribution installed via WSL (Ubuntu recommended)

  • Python 3.9+ installed on your WSL distribution

  • A Google Cloud account with Gemini API access

Installation Steps

1. Prepare Your WSL Environment

First, ensure your WSL environment is up-to-date:

# Open your WSL terminal
wsl

# Update your Linux distribution
sudo apt update && sudo apt upgrade -y

# Install Python dependencies
sudo apt install -y python3-pip python3-venv python3-dev build-essential

2. Create a Python Virtual Environment

3. Install Google Generative AI SDK

4. Configure Authentication

Using API Key

  1. Visit Google AI Studioarrow-up-right in your Windows browser

  2. Create and copy your API key

  3. In your WSL terminal, add to your environment:

Using Service Account (Production)

6. Verify Installation

Create a test file:

WSL-Specific Considerations

Filesystem Performance

For best performance when working with large projects:

GPU Acceleration for ML Workloads

WSL2 supports GPU acceleration, which can improve performance for large ML operations:

  1. Install the latest NVIDIA CUDA drivers on Windows

  2. Install CUDA support in your WSL distribution:

  1. Verify GPU access from WSL:

Windows/WSL Integration

You can integrate Gemini with both Windows and Linux tools:

Troubleshooting WSL-Specific Issues

  1. Network Connectivity Issues:

  2. File Permission Problems:

  3. WSL Memory Limitations: Create a .wslconfig file in your Windows user directory:

Last updated