> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/open-webui/open-webui/llms.txt
> Use this file to discover all available pages before exploring further.

# Python pip Installation

> Install Open WebUI using Python pip

Install and run Open WebUI directly using Python pip for development or lightweight deployments.

## Prerequisites

* Python 3.11 or 3.12 (Python 3.13 is not yet supported)
* pip package manager
* Git (for development installation)

<Warning>
  Open WebUI requires Python 3.11 or 3.12. Make sure you're using a compatible version to avoid compatibility issues.
</Warning>

## Quick Installation

<Steps>
  <Step title="Install Open WebUI">
    Install using pip:

    ```bash theme={null}
    pip install open-webui
    ```
  </Step>

  <Step title="Start the Server">
    Run Open WebUI:

    ```bash theme={null}
    open-webui serve
    ```

    The server will start on [http://localhost:8080](http://localhost:8080)
  </Step>
</Steps>

## Installation Options

### Standard Installation

Basic installation with core dependencies:

```bash theme={null}
pip install open-webui
```

### PostgreSQL Support

Install with PostgreSQL support:

```bash theme={null}
pip install open-webui[postgres]
```

This includes:

* `psycopg2-binary` - PostgreSQL adapter
* `pgvector` - PostgreSQL vector extension

### All Optional Dependencies

Install with all optional dependencies:

```bash theme={null}
pip install open-webui[all]
```

Includes additional packages for:

* Vector databases (Qdrant, Milvus, Pinecone, Weaviate, Elasticsearch, Oracle)
* Cloud storage emulators
* Testing frameworks
* Document processing tools

## System Dependencies

Open WebUI requires several system packages. Install them based on your OS:

### Ubuntu/Debian

```bash theme={null}
sudo apt-get update
sudo apt-get install -y \
  git \
  build-essential \
  pandoc \
  gcc \
  netcat-openbsd \
  curl \
  jq \
  python3-dev \
  ffmpeg \
  libsm6 \
  libxext6
```

### macOS

```bash theme={null}
brew install pandoc ffmpeg
```

### Windows

Install the following:

* [Pandoc](https://pandoc.org/installing.html)
* [FFmpeg](https://ffmpeg.org/download.html)
* [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)

## Configuration

### Environment Variables

Create a `.env` file in your working directory:

```bash .env theme={null}
# Ollama Configuration
OLLAMA_BASE_URL='http://localhost:11434'

# OpenAI Configuration
OPENAI_API_BASE_URL=''
OPENAI_API_KEY=''

# Database Configuration
DATABASE_URL='sqlite:///./data/webui.db'

# Security
WEBUI_SECRET_KEY='your-secret-key-here'

# CORS Settings
CORS_ALLOW_ORIGIN='*'

# Telemetry
SCARF_NO_ANALYTICS=true
DO_NOT_TRACK=true
ANONYMIZED_TELEMETRY=false
```

### Data Directory

By default, Open WebUI stores data in:

* **Linux/macOS**: `~/.local/share/open-webui/data/`
* **Windows**: `%APPDATA%\open-webui\data\`

Customize with the `DATA_DIR` environment variable:

```bash theme={null}
export DATA_DIR=/path/to/data
open-webui serve
```

## Running Open WebUI

### Basic Usage

```bash theme={null}
open-webui serve
```

### Custom Port

```bash theme={null}
PORT=3000 open-webui serve
```

### With Environment Variables

```bash theme={null}
OLLAMA_BASE_URL=http://localhost:11434 \
WEBUI_SECRET_KEY=$(openssl rand -base64 32) \
open-webui serve
```

### Production Mode

For production, use a production-grade WSGI server:

```bash theme={null}
pip install gunicorn
gunicorn open_webui.main:app \
  --workers 4 \
  --worker-class uvicorn.workers.UvicornWorker \
  --bind 0.0.0.0:8080
```

## Development Installation

For development with hot-reload:

<Steps>
  <Step title="Clone the Repository">
    ```bash theme={null}
    git clone https://github.com/open-webui/open-webui.git
    cd open-webui
    ```
  </Step>

  <Step title="Install Backend Dependencies">
    ```bash theme={null}
    cd backend
    pip install -r requirements.txt
    ```
  </Step>

  <Step title="Install Frontend Dependencies">
    ```bash theme={null}
    cd ..
    npm install
    ```
  </Step>

  <Step title="Run Development Server">
    Backend (in `backend/` directory):

    ```bash theme={null}
    bash start.sh
    ```

    Frontend (in root directory):

    ```bash theme={null}
    npm run dev
    ```
  </Step>
</Steps>

## Upgrading

### Upgrade to Latest Version

```bash theme={null}
pip install --upgrade open-webui
```

### Upgrade with Dependencies

```bash theme={null}
pip install --upgrade --force-reinstall open-webui
```

## Uninstalling

```bash theme={null}
pip uninstall open-webui
```

<Note>
  Uninstalling Open WebUI does not remove your data directory. Back up or manually delete it if needed.
</Note>

## Virtual Environment (Recommended)

Use a virtual environment to isolate dependencies:

### Using venv

```bash theme={null}
# Create virtual environment
python -m venv open-webui-env

# Activate (Linux/macOS)
source open-webui-env/bin/activate

# Activate (Windows)
open-webui-env\Scripts\activate

# Install Open WebUI
pip install open-webui

# Run
open-webui serve
```

### Using conda

```bash theme={null}
# Create environment
conda create -n open-webui python=3.11

# Activate
conda activate open-webui

# Install
pip install open-webui

# Run
open-webui serve
```

## GPU Support (CUDA)

For CUDA GPU acceleration:

<Steps>
  <Step title="Install CUDA Toolkit">
    Install [NVIDIA CUDA Toolkit](https://developer.nvidia.com/cuda-downloads) for your platform.
  </Step>

  <Step title="Install PyTorch with CUDA">
    ```bash theme={null}
    # For CUDA 12.1
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

    # For CUDA 11.8
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
    ```
  </Step>

  <Step title="Install Open WebUI">
    ```bash theme={null}
    pip install open-webui
    ```
  </Step>
</Steps>

## Apple Silicon (M1/M2) Support

For Apple Silicon Macs, use Metal Performance Shaders (MPS):

```bash theme={null}
# Install with MPS support
pip install open-webui

# PyTorch will automatically use MPS when available
open-webui serve
```

## Troubleshooting

### Import Errors

If you encounter import errors, ensure you're using Python 3.11 or 3.12:

```bash theme={null}
python --version
```

### Permission Errors

Use `--user` flag to install in user directory:

```bash theme={null}
pip install --user open-webui
```

### Database Errors

If database migrations fail:

```bash theme={null}
# Reset database (WARNING: This deletes all data)
rm -rf ~/.local/share/open-webui/data/webui.db
open-webui serve
```

### Port Already in Use

Change the port:

```bash theme={null}
PORT=8081 open-webui serve
```

### Missing System Dependencies

Ensure all system dependencies are installed (see System Dependencies section above).

## Environment-Specific Notes

### WSL (Windows Subsystem for Linux)

On WSL, ensure you have the required system packages:

```bash theme={null}
sudo apt-get update
sudo apt-get install -y build-essential python3-dev
```

### Docker Alternative

If pip installation doesn't work for your environment, consider using [Docker deployment](/deployment/docker) instead.

## Next Steps

<CardGroup cols={2}>
  <Card title="Environment Variables" icon="gear" href="/deployment/environment-variables">
    Configure Open WebUI with environment variables
  </Card>

  <Card title="Docker Deployment" icon="docker" href="/deployment/docker">
    Alternative Docker-based installation
  </Card>

  <Card title="Updating" icon="arrow-up" href="/deployment/updating">
    Keep your installation up-to-date
  </Card>

  <Card title="Configuration" icon="sliders" href="/getting-started/configuration">
    Configure Open WebUI features
  </Card>
</CardGroup>
