InvokeAI/docs/installation/020_INSTALL_MANUAL.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

167 lines
5.5 KiB
Markdown
Raw Normal View History

2024-03-26 10:43:35 +00:00
# Manual Install
!!! warning "This is for Advanced Users"
2024-03-26 10:43:35 +00:00
**Python experience is mandatory.**
## Introduction
2023-02-07 02:47:29 +00:00
!!! tip "Conda"
2024-03-26 10:43:35 +00:00
As of InvokeAI v2.3.0 installation using the `conda` package manager is no longer being supported. It will likely still work, but we are not testing this installation method.
2024-03-26 10:43:35 +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 that you'll need to manage manually, described in this guide.
2024-03-26 10:43:35 +00:00
### Requirements
2024-03-26 10:43:35 +00:00
Before you start, go through the [installation requirements].
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
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`.
!!! info "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 pass the directory using the `--root` CLI arg.
2023-02-07 02:47:29 +00:00
```terminal
cd $INVOKEAI_ROOT
2024-03-26 10:43:35 +00:00
python3 -m venv .venv --prompt InvokeAI
```
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-07 04:59:48 +00:00
```bash
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
```ps
.venv\Scripts\activate
```
2023-02-07 02:47:29 +00:00
2024-03-26 10:43:35 +00:00
!!! info "Permissions Error (Windows)"
If you get a permissions error at this point, run this command and try again
`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`
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.
2024-03-26 10:43:35 +00:00
1. Make sure that pip is installed in your virtual environment and up to date:
```bash
2024-03-26 10:43:35 +00:00
python3 -m pip install --upgrade pip
```
2024-03-26 10:43:35 +00:00
1. Install the InvokeAI Package. The `--extra-index-url` option is used to select the correct `torch` backend:
2023-02-07 04:59:48 +00:00
=== "CUDA (NVidia)"
2024-03-26 10:43:35 +00:00
```bash
pip install "InvokeAI[xformers]" --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121
```
2023-02-07 19:19:55 +00:00
2023-02-07 04:59:48 +00:00
=== "ROCm (AMD)"
2024-03-26 10:43:35 +00:00
```bash
pip install InvokeAI --use-pep517 --extra-index-url https://download.pytorch.org/whl/rocm5.6
```
2023-02-07 04:59:48 +00:00
=== "CPU (Intel Macs & non-GPU systems)"
2024-03-26 10:43:35 +00:00
```bash
pip install InvokeAI --use-pep517 --extra-index-url https://download.pytorch.org/whl/cpu
```
2023-02-07 04:59:48 +00:00
2024-03-26 10:43:35 +00:00
=== "MPS (Apple Silicon)"
2024-03-26 10:43:35 +00:00
```bash
pip install InvokeAI --use-pep517
```
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:
2024-03-26 10:43:35 +00:00
=== "Linux/macOS"
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-07 04:59:48 +00:00
=== "Windows"
```ps
2023-02-07 19:19:55 +00:00
deactivate
.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-03-26 10:43:35 +00:00
If the virtual environment you selected is NOT inside `INVOKEAI_ROOT`, then you must specify the path to the root directory by adding
`--root_dir \path\to\invokeai`.
!!! tip
2023-02-07 19:19:55 +00:00
You can permanently set the location of the runtime directory
by setting the environment variable `INVOKEAI_ROOT` to the
path of the directory. As mentioned previously, this is
2024-03-26 10:43:35 +00:00
recommended if your virtual environment is located outside of
2023-02-07 19:19:55 +00:00
your runtime directory.
!!! tip
2024-03-26 10:43:35 +00:00
On Linux, it is recommended to run invokeai with the following env var: `MALLOC_MMAP_THRESHOLD_=1048576`. For example: `MALLOC_MMAP_THRESHOLD_=1048576 invokeai --web`. This helps to prevent memory fragmentation that can lead to memory accumulation over time. This env var is set automatically when running via `invoke.sh`.
2024-03-26 10:43:35 +00:00
## Unsupported Conda Install
2024-03-26 10:43:35 +00:00
Congratulations, you found the "secret" Conda installation instructions. If you really **really** want to use Conda with InvokeAI, you can do so using this unsupported recipe:
2024-03-26 10:43:35 +00:00
```sh
mkdir ~/invokeai
2024-03-26 10:43:35 +00:00
conda create -n invokeai python=3.11
conda activate invokeai
2024-03-26 10:43:35 +00:00
# Adjust this as described above for the appropriate torch backend
2023-11-14 00:13:34 +00:00
pip install InvokeAI[xformers] --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121
2024-03-26 10:43:35 +00:00
invokeai-web --root ~/invokeai
```
The `pip install` command shown in this recipe is for Linux/Windows
systems with an NVIDIA GPU. See step (6) above for the command to use
with other platforms/GPU combinations. If you don't wish to pass the
`--root` argument to `invokeai` with each launch, you may set the
2024-03-26 10:43:35 +00:00
environment variable `INVOKEAI_ROOT` to point to the installation directory.
Note that if you run into problems with the Conda installation, the InvokeAI
staff will **not** be able to help you out. Caveat Emptor!
2024-03-26 10:43:35 +00:00
[installation requirements]: INSTALL_REQUIREMENTS.md