2024-03-26 10:43:35 +00:00
# Manual Install
2022-12-15 20:08:07 +00:00
2023-08-25 01:59:46 +00:00
!!! warning "This is for Advanced Users"
2022-12-15 20:08:07 +00:00
2024-03-26 10:43:35 +00:00
**Python experience is mandatory.**
2022-12-15 20:08:07 +00:00
## Introduction
2024-04-03 23:14:50 +00:00
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.
2023-02-10 16:29:12 +00:00
2024-03-26 10:43:35 +00:00
### Requirements
2023-02-10 16:29:12 +00:00
2024-03-26 10:43:35 +00:00
Before you start, go through the [installation requirements].
2022-12-24 21:11:51 +00:00
2023-02-07 02:47:29 +00:00
### Installation Walkthrough
2024-03-26 10:43:35 +00:00
1. Create a directory to contain your InvokeAI library, configuration
2023-02-07 02:47:29 +00:00
files, and models. This is known as the "runtime" or "root"
directory, and often lives in your home directory under the name `invokeai` .
2024-03-26 10:43:35 +00:00
We will refer to this directory as `INVOKEAI_ROOT` . For convenience, create an environment variable pointing to the directory.
2023-02-07 02:47:29 +00:00
2024-03-26 10:43:35 +00:00
=== "Linux/macOS"
2023-02-08 19:07:12 +00:00
2023-02-07 02:47:29 +00:00
```bash
2023-02-10 16:29:12 +00:00
export INVOKEAI_ROOT=~/invokeai
2023-02-07 04:59:48 +00:00
mkdir $INVOKEAI_ROOT
2023-02-07 02:47:29 +00:00
```
2024-03-26 10:43:35 +00:00
=== "Windows (PowerShell)"
2023-02-08 19:07:12 +00:00
2023-02-07 02:47:29 +00:00
```bash
2023-02-07 19:19:55 +00:00
Set-Variable -Name INVOKEAI_ROOT -Value $Home/invokeai
2023-02-07 04:59:48 +00:00
mkdir $INVOKEAI_ROOT
2023-02-07 02:47:29 +00:00
```
2024-03-26 10:43:35 +00:00
1. Enter the root (invokeai) directory and create a virtual Python environment within it named `.venv` .
2024-04-03 22:55:18 +00:00
!!! warning "Virtual Environment Location"
2024-03-26 10:43:35 +00:00
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.
2024-04-03 22:55:18 +00:00
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.
2023-02-07 02:47:29 +00:00
2023-02-10 16:29:12 +00:00
```terminal
cd $INVOKEAI_ROOT
2024-03-26 10:43:35 +00:00
python3 -m venv .venv --prompt InvokeAI
2023-02-10 16:29:12 +00:00
```
2024-03-26 10:43:35 +00:00
1. Activate the new environment:
2023-02-07 02:47:29 +00:00
2024-03-26 10:43:35 +00:00
=== "Linux/macOS"
2023-02-10 16:29:12 +00:00
2023-02-07 04:59:48 +00:00
```bash
2023-02-10 16:29:12 +00:00
source .venv/bin/activate
2023-02-07 04:59:48 +00:00
```
2023-02-07 02:47:29 +00:00
2023-02-07 04:59:48 +00:00
=== "Windows"
2023-02-07 02:47:29 +00:00
2023-02-10 16:29:12 +00:00
```ps
2023-02-11 08:29:44 +00:00
.venv\Scripts\activate
2023-02-10 16:29:12 +00:00
```
2023-02-07 02:47:29 +00:00
2024-03-26 10:43:35 +00:00
!!! info "Permissions Error (Windows)"
2023-02-10 16:29:12 +00:00
If you get a permissions error at this point, run this command and try again
2023-02-03 13:51:46 +00:00
2023-02-10 16:29:12 +00:00
`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`
2022-12-15 20:08:07 +00:00
2024-03-26 10:43:35 +00:00
The command-line prompt should change to to show `(InvokeAI)` at the beginning of the prompt.
The following steps should be run while inside the `INVOKEAI_ROOT` directory.
2022-12-15 20:08:07 +00:00
2024-03-26 10:43:35 +00:00
1. Make sure that pip is installed in your virtual environment and up to date:
2022-12-15 20:08:07 +00:00
2023-02-03 13:51:46 +00:00
```bash
2024-03-26 10:43:35 +00:00
python3 -m pip install --upgrade pip
2023-02-03 13:51:46 +00:00
```
2022-12-15 20:08:07 +00:00
2024-04-03 23:14:50 +00:00
1. 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.
2023-02-07 19:19:55 +00:00
2024-04-03 23:14:50 +00:00
- 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.
2023-02-10 16:29:12 +00:00
2024-04-03 23:14:50 +00:00
!!! example "Install with an extra index URL"
2023-02-07 04:59:48 +00:00
2024-04-03 23:14:50 +00:00
```bash
pip install InvokeAI --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121
```
2023-02-10 16:29:12 +00:00
2024-04-03 23:14:50 +00:00
- 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 necessary. PyTorch includes an implementation of the SDP attention algorithm with the same performance.
2023-02-07 04:59:48 +00:00
2024-04-03 23:14:50 +00:00
!!! example "Install with `xformers` "
2023-02-10 16:29:12 +00:00
2024-04-03 23:14:50 +00:00
```bash
pip install "InvokeAI[xformers]" --use-pep517
```
2022-12-15 20:08:07 +00:00
2024-03-26 10:43:35 +00:00
1. Deactivate and reactivate your runtime directory so that the invokeai-specific commands become available in the environment:
2022-12-15 20:08:07 +00:00
2024-03-26 10:43:35 +00:00
=== "Linux/macOS"
2023-02-10 16:29:12 +00:00
2023-02-07 04:59:48 +00:00
```bash
2023-02-07 19:19:55 +00:00
deactivate & & source .venv/bin/activate
2023-02-07 04:59:48 +00:00
```
2023-02-03 13:51:46 +00:00
2023-02-07 04:59:48 +00:00
=== "Windows"
2023-02-10 16:29:12 +00:00
```ps
2023-02-07 19:19:55 +00:00
deactivate
2023-02-10 01:28:20 +00:00
.venv\Scripts\activate
2023-02-07 04:59:48 +00:00
```
2023-02-07 02:47:29 +00:00
2024-03-26 10:43:35 +00:00
1. Run the application:
2023-08-01 05:29:29 +00:00
2024-03-26 10:43:35 +00:00
Run `invokeai-web` to start the UI. You must activate the virtual environment before running the app.
2023-08-01 05:29:29 +00:00
2024-04-03 22:55:18 +00:00
!!! warning
2022-12-15 20:08:07 +00:00
2024-04-03 22:55:18 +00:00
If the virtual environment is _not_ inside the root directory, then you _must_ specify the path to the root directory with `--root_dir \path\to\invokeai` or the `INVOKEAI_ROOT` environment variable.