Skip to content

Manual Install#

Warning

Python experience is mandatory.

If you want to use Invoke locally, you should probably use the installer.

If you want to contribute to Invoke, instead follow the dev environment guide.

InvokeAI is distributed as a python package on PyPI, installable with pip. There are a few things that are handled by the installer and launcher that you'll need to manage manually, described in this guide.

Requirements#

Before you start, go through the installation requirements.

Walkthrough#

  1. Create a directory to contain your InvokeAI library, configuration files, and models. This is known as the "runtime" or "root" directory, and typically lives in your home directory under the name invokeai.

    mkdir ~/invokeai
    
    mkdir $Home/invokeai
    
  2. Enter the root directory and create a virtual Python environment within it named .venv.

    Virtual Environment Location

    While you may create the virtual environment anywhere in the file system, we recommend that you create it within the root directory as shown here. This allows the application to automatically detect its data directories.

    If you choose a different location for the venv, then you must set the INVOKEAI_ROOT environment variable or specify the root directory using the --root CLI arg.

    cd ~/invokeai
    python3 -m venv .venv --prompt InvokeAI
    
    cd $Home/invokeai
    python3 -m venv .venv --prompt InvokeAI
    
  3. Activate the new environment:

    source .venv/bin/activate
    
    .venv\Scripts\activate
    

    Permissions Error (Windows)

    If you get a permissions error at this point, run this command and try again.

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

    The command-line prompt should change to to show (InvokeAI), indicating the venv is active.

  4. Make sure that pip is installed in your virtual environment and up to date:

    python3 -m pip install --upgrade pip
    
  5. Install the InvokeAI Package. The base command is pip install InvokeAI --use-pep517, but you may need to change this depending on your system and the desired features.

    • You may need to provide an extra index URL. Select your platform configuration using this tool on the PyTorch website. Copy the --extra-index-url string from this and append it to your install command.

      pip install InvokeAI --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121
      
    • If you have a CUDA GPU and want to install with xformers, you need to add an option to the package name. Note that xformers is not strictly necessary. PyTorch includes an implementation of the SDP attention algorithm with similar performance for most GPUs.

      pip install "InvokeAI[xformers]" --use-pep517
      
  6. Deactivate and reactivate your venv so that the invokeai-specific commands become available in the environment:

    deactivate && source .venv/bin/activate
    
    deactivate
    .venv\Scripts\activate
    
  7. Run the application:

    Run invokeai-web to start the UI. You must activate the virtual environment before running the app.

    Warning

    If the virtual environment is not inside the root directory, then you must specify the path to the root directory with --root \path\to\invokeai or the INVOKEAI_ROOT environment variable.