Simple Installer for Unified Directory Structure, Initial Implementation (#1819)

* partially working simple installer

* works on linux

* fix linux requirements files

* read root environment variable in right place

* fix cat invokeai.init in test workflows

* fix classical cp error in test-invoke-pip.yml

* respect --root argument now

* untested bat installers added

* windows install.bat now working

fix logic to find frontend files

* rename simple_install to "installer"

1. simple_install => 'installer'
2. source and binary install directories are removed

* enable update scripts to update requirements

- Also pin requirements to known working commits.
- This may be a breaking change; exercise with caution
- No functional testing performed yet!

* update docs and installation requirements

NOTE: This may be a breaking commit! Due to the way the installer
works, I have to push to a public branch in order to do full end-to-end
testing.

- Updated installation docs, removing binary and source installers and
  substituting the "simple" unified installer.
- Pin requirements for the "http:" downloads to known working commits.
- Removed as much as possible the invoke-ai forks of others' repos.

* fix directory path for installer

* correct requirement/environment errors

* exclude zip files in .gitignore

* possible fix for dockerbuild

* ready for torture testing

- final Windows bat file tweaks
- copy environments-and-requirements to the runtime directory so that
  the `update.sh` script can run.

  This is not ideal, since we lose control over the
  requirements. Better for the update script to pull the proper
  updated requirements script from the repository.

* allow update.sh/update.bat to install arbitrary InvokeAI versions

- Can pass the zip file path to any InvokeAI release, branch, commit or tag,
  and the installer will try to install it.
- Updated documentation
- Added Linux Python install hints.

* use binary installer's :err_exit function

* user diffusers 0.10.0

* added logic for CPPFLAGS on mac

* improve windows install documentation

- added information on a couple of gotchas I experienced during
  windows installation, including DLL loading errors experienced
  when Visual Studio C++ Redistributable was not present.

* tagged to pull from 2.2.4-rc1

- also fix error of shell window closing immediately if suitable
  python not found

Co-authored-by: mauwii <Mauwii@outlook.de>
This commit is contained in:
Lincoln Stein 2022-12-11 00:37:08 -05:00 committed by GitHub
parent ef6870c714
commit 0439b51a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 1068 additions and 558 deletions

View File

@ -114,9 +114,9 @@ jobs:
run: |
python scripts/configure_invokeai.py --no-interactive --yes
- name: cat ~/.invokeai
- name: cat invokeai.init
id: cat-invokeai
run: cat ~/.invokeai
run: cat ${{ env.INVOKEAI_ROOT }}/invokeai.init
- name: Run the tests
id: run-tests

11
.gitignore vendored
View File

@ -222,12 +222,11 @@ environment.yml
requirements.txt
# source installer files
source_installer/*zip
source_installer/invokeAI
install.bat
install.sh
update.bat
update.sh
installer/*zip
installer/install.bat
installer/install.sh
installer/update.bat
installer/update.sh
# this may be present if the user created a venv
invokeai

View File

@ -246,14 +246,16 @@ class InvokeAIWebServer:
def find_frontend(self):
my_dir = os.path.dirname(__file__)
# LS: setup.py seems to put the frontend in different places on different systems, so
# this is fragile and needs to be replaced with a better way of finding the front end.
for candidate in (os.path.join(my_dir,'..','frontend','dist'), # pip install -e .
os.path.join(my_dir,'../../../../frontend','dist') # pip install .
os.path.join(my_dir,'../../../../frontend','dist'), # pip install . (Linux, Mac)
os.path.join(my_dir,'../../../frontend','dist'), # pip install . (Windows)
):
if os.path.exists(candidate):
return candidate
assert "Frontend files cannot be found. Cannot continue"
def setup_app(self):
self.result_url = "outputs/"
self.init_image_url = "outputs/init-images/"

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
echo "Be certain that you're in the 'installer' directory before continuing."
read -p "Press any key to continue, or CTRL-C to exit..."
VERSION='2.2.3'
# make the installer zip for linux and mac
rm -rf InvokeAI
mkdir -p InvokeAI
cp install.sh.in InvokeAI/install.sh
chmod a+x InvokeAI/install.sh
cp readme.txt InvokeAI
zip -r InvokeAI-binary-$VERSION-linux.zip InvokeAI
zip -r InvokeAI-binary-$VERSION-mac.zip InvokeAI
# make the installer zip for windows
rm -rf InvokeAI
mkdir -p InvokeAI
cp install.bat.in InvokeAI/install.bat
cp readme.txt InvokeAI
cp WinLongPathsEnabled.reg InvokeAI
zip -r InvokeAI-binary-$VERSION-windows.zip InvokeAI
rm -rf InvokeAI
echo "The installer zips are ready for distribution."

View File

@ -2,10 +2,6 @@
set -eu
# ensure we're in the correct folder in case user's CWD is somewhere else
scriptdir=$(dirname "$0")
cd "$scriptdir"
. .venv/bin/activate
# set required env var for torch on mac MPS

View File

@ -36,7 +36,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \
COPY . .
RUN --mount=type=cache,target=/root/.cache/pip \
cp binary_installer/py3.10-linux-x86_64-cuda-reqs.txt requirements.txt && \
cp environments-and-requirements/requirements-lin-cuda.txt requirements.txt && \
pip install -r requirements.txt &&\
pip install -e .

View File

@ -82,13 +82,18 @@ Mac and Linux machines, and runs on GPU cards with as little as 4 GB or RAM.
This fork is supported across Linux, Windows and Macintosh. Linux
users can use either an Nvidia-based card (with CUDA support) or an
AMD card (using the ROCm driver). For full installation and upgrade
instructions, please see:
[InvokeAI Installation Overview](https://invoke-ai.github.io/InvokeAI/installation/)
AMD card (using the ROCm driver).
First time users, please see [Automated
Installer](installation/INSTALL_AUTOMATED.md) for a walkthrough of
getting InvokeAI up and running on your system. For alternative
installation and upgrade instructions, please see: [InvokeAI
Installation Overview](installation/)
Linux users who wish to make use of the PyPatchMatch inpainting
functions will need to perform a bit of extra work to enable this
module. Instructions can be found at [Installing PyPatchMatch](installation/INSTALL_PATCHMATCH.md).
module. Instructions can be found at [Installing
PyPatchMatch](installation/INSTALL_PATCHMATCH.md).
## :fontawesome-solid-computer: Hardware Requirements
@ -100,9 +105,13 @@ You wil need one of the following:
- :simple-amd: An AMD-based graphics card with 4 GB or more VRAM memory (Linux only)
- :fontawesome-brands-apple: An Apple computer with an M1 chip.
We do not recommend the GTX 1650 or 1660 series video cards. They are
unable to run in half-precision mode and do not come with sufficient VRAM
to render 512x512 images.
We do **not recommend** the following video cards due to issues with
their running in half-precision mode and having insufficient VRAM to
render 512x512 images in full-precision mode:
- NVIDIA 10xx series cards such as the 1080ti
- GTX 1650 series cards
- GTX 1660 series cards
### :fontawesome-solid-memory: Memory
@ -110,16 +119,11 @@ to render 512x512 images.
### :fontawesome-regular-hard-drive: Disk
- At least 12 GB of free disk space for the machine learning model, Python, and
- At least 18 GB of free disk space for the machine learning model, Python, and
all its dependencies.
!!! info
If you are have a Nvidia 10xx series card (e.g. the 1080ti), please run the invoke script in
full-precision mode as shown below.
Similarly, specify full-precision mode on Apple M1 hardware.
Precision is auto configured based on the device. If however you encounter errors like
`expected type Float but found Half` or `not implemented for Half` you can try starting
`invoke.py` with the `--precision=float32` flag:

View File

@ -0,0 +1,310 @@
---
title: InvokeAI Automated Installation
---
# InvokeAI Automated Installation
## Introduction
The automated installer is a shell script that attempts to automate
every step needed to install and run InvokeAI on a stock computer
running recent versions of Linux, MacOS or Windows. It will leave you
with a version that runs a stable version of InvokeAI with the option
to upgrade to experimental versions later.
## Walk through
1. Make sure that your system meets the [hardware
requirements](../index.md#hardware-requirements) and has the
appropriate GPU drivers installed. In particular, if you are a Linux
user with an AMD GPU installed, you may need to install the [ROCm
driver](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html).
- Installation requires roughly 18G of free disk space to load the libraries and
recommended model weights files.
2. Check that your system has an up-to-date Python installed. To do
this, open up a command-line window ("Terminal" on Linux and
Macintosh, "Command" or "Powershell" on Windows) and type `python
--version`. If Python is installed, it will print out the version
number. If it is version `3.9.1` or higher, you meet requirements.
- If you see an older version, or you get a command not found
error, then go to [Python
Downloads](https://www.python.org/downloads/) and download the
appropriate installer package for your platform. We recommend
[Version
3.10.9](https://www.python.org/downloads/release/python-3109/),
which has been extensively tested with InvokeAI.
-**Windows users**: During the Python configuration process,
Please look out for a checkbox to add Python to your PATH
and select it. If the install script complains that it can't
find python, then open the Python installer again and choose
"Modify" existing installation.
- **Mac users**: After installing Python, you may need to run the
following command from the Terminal in order to install the Web
certificates needed to download model data from https sites. If
you see lots of CERTIFICATE ERRORS during the last part of the
install, this is the problem:
`/Applications/Python\ 3.10/Install\ Certificates.command`
Do not use Python 3.11 at this time due to poor performance
of the underlying pytorch machine learning library.
- **Linux users**: See [Installing Python in Ubuntu](#installing-python-in-ubuntu) for some
platform-specific tips.
3. The source installer is distributed in ZIP files. Go to the
[latest release](https://github.com/invoke-ai/InvokeAI/releases/latest), and
look for a series of files named:
- [InvokeAI-installer-2.2.4-mac.zip](https://github.com/invoke-ai/InvokeAI/releases/latest/download/InvokeAI-installer-2.2.4-mac.zip)
- [InvokeAI-installer-2.2.4-windows.zip](https://github.com/invoke-ai/InvokeAI/releases/latest/download/InvokeAI-installer-2.2.4-windows.zip)
- [InvokeAI-installer-2.2.4-linux.zip](https://github.com/invoke-ai/InvokeAI/releases/latest/download/InvokeAI-installer-2.2.4-linux.zip)
Download the one that is appropriate for your operating system.
4. If you are a macOS user, you may need to install the Xcode command line tools.
These are a set of tools that are needed to run certain applications in a Terminal,
including InvokeAI. This package is provided directly by Apple.
- To install, open a terminal window and run `xcode-select
--install`. You will get a macOS system popup guiding you through
the install. If you already have them installed, you will instead
see some output in the Terminal advising you that the tools are
already installed.
- More information can be found here:
https://www.freecodecamp.org/news/install-xcode-command-line-tools/
5. If you are a Windows users, there is a slight possibility that you
will encountered DLL load errors at the very end of the installation
process. This is caused by not having up to date Visual C++
redistributable libraries. If this happens to you, you can install
the C++ libraries from this site:
https://learn.microsoft.com/en-us/cpp/windows/deploying-native-desktop-applications-visual-cpp?view=msvc-170
6. Unpack the zip file into a convenient directory. This will create
a new directory named "InvokeAI-Installer". This example shows how
this would look using the `unzip` command-line tool, but you may
use any graphical or command-line Zip extractor:
```cmd
C:\Documents\Linco> unzip InvokeAI-installer-2.2.4-windows.zip
Archive: C: \Linco\Downloads\InvokeAI-installer-2.2.4-windows.zip
creating: InvokeAI-Installer\
inflating: InvokeAI-Installer\install.bat
inflating: InvokeAI-Installer\readme.txt
...
```
After successful installation, you can delete the
`InvokeAI-Installer` directory.
7. Windows users should now double-click on the file WinLongPathsEnabled.reg
and accept the dialog box that asks you if you wish to modify your
registry. This activates long filename support on your system and will
prevent mysterious errors during installation.
8. If you are using a desktop GUI, double-click the installer file. It will be
named `install.bat` on Windows systems and `install.sh` on Linux and
Macintosh systems.
On Windows systems you will probably get an "Untrusted Publisher" warning.
Click on "More Info" and select "Run Anyway." You trust us, right?
9. Alternatively, from the command line, run the shell script or .bat file:
```cmd
C:\Documents\Linco> cd InvokeAI-Installer
C:\Documents\Linco\invokeAI> install.bat
```
10. The script will ask you to choose where to install InvokeAI. Select
a directory with at least 18G of free space for a full
install. InvokeAI and all its support files will be installed into
a new directory named `invokeai` located at the location you specify.
- The default is to install the `invokeai` directory in your home
directory, usually `C:\Users\YourName\invokeai` on Windows systems,
`/home/YourName/invokeai` on Linux systems, and
`/Users/YourName/invokeai` on Macintoshes, where "YourName" is your
login name.
- The script uses tab autocompletion to suggest directory path
completions. Type part of the path (e.g. "C:\Users") and press
&lt;tab&gt; repeatedly to suggest completions.
11. Sit back and let the install script work. It will install the
third-party libraries needed by InvokeAI, then download the
current InvokeAI release and install it.
Be aware that some of the library download and install steps take
a long time. In particular, the `pytorch` package is quite large
and often appears to get "stuck" at 99.9%. Have patience and the
installation step will eventually resume. However, there are
occasions when the library install does legitimately get stuck. If
you have been waiting for more than ten minutes and nothing is
happening, you can interrupt the script with ^C. You may restart
it and it will pick up where it left off.
12. After installation completes, the installer will launch a script
called `configure_invokeai.py`, which will guide you through the
first-time process of selecting one or more Stable Diffusion model
weights files, downloading and configuring them. We provide a list
of popular models that InvokeAI performs well with. However, you
can add more weight files later on using the command-line client
or the Web UI. See [Installing Models](INSTALLING_MODELS.md) for details.
Note that the main Stable Diffusion weights file is protected by a license
agreement that you must agree to in order to use. The script will list the
steps you need to take to create an account on the official site that hosts
the weights files, accept the agreement, and provide an access token that
allows InvokeAI to legally download and install the weights files.
If you have already downloaded the weights file(s) for another Stable
Diffusion distribution, you may skip this step (by selecting "skip" when
prompted) and configure InvokeAI to use the previously-downloaded files. The
process for this is described in [Installing Models](INSTALLING_MODELS.md).
13. The script will now exit and you'll be ready to generate some
images. Look for the directory `invokeai` installed in the
location you chose at the beginning of the install session. Look
for a shell script named `invoke.sh` (Linux/Mac) or `invoke.bat`
(Windows). Launch the script by double-clicking it or typing its
name at the command-line:
```cmd
C:\Documents\Linco> cd invokeai
C:\Documents\Linco\invokeAI> invoke.bat
```
- The `invoke.bat` (`invoke.sh`) script will give you the choice of starting (1)
the command-line interface, or (2) the web GUI. If you start the latter, you can
load the user interface by pointing your browser at http://localhost:9090.
- The script also offers you a third option labeled "open the developer
console". If you choose this option, you will be dropped into a
command-line interface in which you can run python commands directly,
access developer tools, and launch InvokeAI with customized options.
14. You can launch InvokeAI with several different command-line arguments
that customize its behavior. For example, you can change the location
of the inage output directory, or select your favorite sampler. See
the [Command-Line Interface](../features/CLI.md) for a full list of
the options.
- To set defaults that will take effect every time you launch InvokeAI,
use a text editor (e.g. Notepad) to exit the file
`invokeai\invokeai.init`. It contains a variety of examples that you can
follow to add and modify launch options.
!!! warning "The `invokeai` directory contains the `invoke` application, its configuration files, the model weight files, and outputs of image generation. Once InvokeAI is installed, do not move or remove this directory."
## Troubleshooting
_Package dependency conflicts_ If you have previously installed
InvokeAI or another Stable Diffusion package, the installer may
occasionally pick up outdated libraries and either the installer or
`invoke` will fail with complaints about library conflicts. You can
address this by entering the `invokeai` directory and running
`update.sh`, which will bring InvokeAI up to date with the latest
libraries.
!!! warning "Some users have tried to correct dependency problems by installing the `ldm` package from PyPi.org. Unfortunately this is an unrelated package that has nothing to do with the 'latent diffusion model' used by InvokeAI. Installing ldm will make matters worse. If you've installed ldm, uninstall it with `pip uninstall ldm`."
_"Corrupted configuration file."__ Everything seems to install ok, but
`invoke` complains of a corrupted configuration file and goes back
into the configuration process (asking you to download models, etc),
but this doesn't fix the problem.
This issue is often caused by a misconfigured configuration directive
in the `invokeai\invokeai.init` initialization file that contains
startup settings. The easiest way to fix the problem is to move the
file out of the way and re-run `configure_invokeai.py`. Enter the
developer's console (option 3 of the launcher script) and run this
command:
```cmd
configure_invokeai.py --root=.
```
Note the dot (.) after `--root`. It is part of the command.
_If none of these maneuvers fixes the problem_ then please report the
problem to the [InvokeAI
Issues](https://github.com/invoke-ai/InvokeAI/issues) section, or
visit our [Discord Server](https://discord.gg/ZmtBAhwWhy) for interactive assistance.
## Updating to newer versions
This distribution is changing rapidly, and we add new features on a daily basis.
To update to the latest released version (recommended), run the `update.sh`
(Linux/Mac) or `update.bat` (Windows) scripts. This will fetch the latest
release and re-run the `configure_invokeai` script to download any updated models
files that may be needed. You can also use this to add additional models that
you did not select at installation time.
You can now close the developer console and run `invoke` as before. If you get
complaints about missing models, then you may need to do the additional step of
running `configure_invokeai.py`. This happens relatively infrequently. To do this,
simply open up the developer's console again and type
`python scripts/configure_invokeai.py`.
You may also use the `update` script to install any selected version
of InvokeAI. From https://github.com/invoke-ai/InvokeAI, navigate to
the zip file link of the version you wish to install. You can find the
zip links by going to the one of the release pages and looking for the
**Assets** section at the bottom. Alternatively, you can browse
"branches" and "tags" at the top of the big code directory on the
InvokeAI welcome page. When you find the version you want to install,
go to the green "&lt;&gt; Code" button at the top, and copy the
"Download ZIP" link.
Now run `update.sh` (or `update.bat`) with the URL of the desired
InvokeAI version as its argument. For example, this will install the
old 2.2.0 release.
```cmd
update.sh https://github.com/invoke-ai/InvokeAI/archive/refs/tags/v2.2.0.zip
```
## Troubleshooting
If you run into problems during or after installation, the InvokeAI team is
available to help you. Either create an
[Issue](https://github.com/invoke-ai/InvokeAI/issues) at our GitHub site, or
make a request for help on the "bugs-and-support" channel of our
[Discord server](https://discord.gg/ZmtBAhwWhy). We are a 100% volunteer
organization, but typically somebody will be available to help you within 24
hours, and often much sooner.
## Installing Python in Ubuntu
For reasons that are not entirely clear, installing the correct
version of Python can be a bit of a challenge on Ubuntu, Linux Mint, and
other Ubuntu-derived distributions.
In particular, Ubuntu version 20.04 LTS comes with an old version of
Python, does not come with the PIP package manager installed, and to
make matters worse, the `python` command points to Python2, not
Python3.
Here is the quick recipe for bringing your system up to date:
```
sudo apt update
sudo apt install python3.9
sudo apt install python3-pip
cd /usr/bin
sudo ln -sf python3.9 python3
sudo ln -sf python3 python
```
You can still access older versions of Python by calling `python2`,
`python3.8`, etc.

View File

@ -8,7 +8,7 @@ title: Manual Installation
!!! warning "This is for advanced Users"
who are already expirienced with using conda or pip
who are already experienced with using conda or pip
## Introduction

View File

@ -5,39 +5,20 @@ title: Overview
We offer several ways to install InvokeAI, each one suited to your
experience and preferences.
1. [InvokeAI source code installer](INSTALL_SOURCE.md)
This is a script that will install Python, the Anaconda ("conda")
package manager, all of InvokeAI's its essential third party
libraries and InvokeAI itself. It includes access to a "developer
console" which will help us debug problems with you and give you
to access experimental features.
1. [Automated Installer](INSTALL_AUTOMATED.md)
When a new InvokeAI feature is available, even between releases,
you will be able to upgrade and try it out by running an `update`
script. This method is recommended for individuals who wish to
stay on the cutting edge of InvokeAI development and are not
afraid of occasional breakage.
To get started go to the bottom of the
[Latest Release Page](https://github.com/invoke-ai/InvokeAI/releases/latest)
and download the .zip file for your platform. Unzip the file.
If you are on a Windows system, double-click on the `install.bat`
script. On a Mac or Linux system, navigate to the file `install.sh`
from within the terminal application, and run the script.
Sit back and watch the script run.
**Important Caveats**
- This script is a bit cranky and occasionally hangs or times out,
forcing you to cancel and restart the script (it will pick up where
it left off).
This is a script that will install all of InvokeAI's essential
third party libraries and InvokeAI itself. It includes access to a
"developer console" which will help us debug problems with you and
give you to access experimental features.
2. [Manual Installation](INSTALL_MANUAL.md)
In this method you will manually run the commands needed to install
InvokeAI and its dependencies. We offer two recipes: one suited to
those who prefer the `conda` tool, and one suited to those who prefer
`pip` and Python virtual environments.
`pip` and Python virtual environments. In our hands the pip install
is faster and more reliable, but your mileage may vary.
This method is recommended for users who have previously used `conda`
or `pip` in the past, developers, and anyone who wishes to remain on
@ -51,9 +32,3 @@ experience and preferences.
individuals with experience with Docker containers and understand
the pluses and minuses of a container-based install.
4. [Jupyter Notebooks Installation](INSTALL_JUPYTER.md)
This method is suitable for running InvokeAI on a Google Colab
account. It is recommended for individuals who have previously
worked on the Colab and are comfortable with the Jupyter notebook
environment.

View File

@ -13,7 +13,6 @@ dependencies:
- cudatoolkit=11.6
- pip:
- albumentations==0.4.3
- basicsr==1.4.1
- dependency_injector==4.40.0
- diffusers==0.6.0
- einops==0.3.0

View File

@ -1,7 +1,7 @@
# pip will resolve the version which matches torch
albumentations
dependency_injector==4.40.0
diffusers==0.9.0
diffusers==0.10.*
einops
eventlet
facexlib
@ -10,6 +10,7 @@ flask_cors==3.0.10
flask_socketio==5.3.0
flaskwebgui==0.3.7
getpass_asterisk
gfpgan==1.3.8
huggingface-hub
imageio
imageio-ffmpeg
@ -17,6 +18,7 @@ kornia
numpy
omegaconf
opencv-python
picklescan
pillow
pip>=22
pudb
@ -31,11 +33,8 @@ taming-transformers-rom1504
test-tube>=0.7.5
torch-fidelity
torchmetrics
transformers==4.21.*
picklescan
# git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.1#egg=gfpgan ; platform_system == 'Windows'
git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.2#egg=gfpgan ; platform_system != 'Windows'
git+https://github.com/openai/CLIP.git@main#egg=clip
git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k-diffusion
git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg
git+https://github.com/invoke-ai/PyPatchMatch@0.1.4#egg=pypatchmatch
transformers==4.25.*
https://github.com/Birch-san/k-diffusion/archive/refs/heads/mps.zip#egg=k-diffusion
https://github.com/invoke-ai/PyPatchMatch/archive/refs/tags/0.1.4.zip#egg=pypatchmatch
https://github.com/openai/CLIP/archive/eaa22acb90a5876642d0507623e859909230a52d.zip#egg=clip
https://github.com/invoke-ai/clipseg/archive/relaxed-python-requirement.zip#egg=clipseg

View File

@ -1,2 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cu116 --trusted-host https://download.pytorch.org
-r environments-and-requirements/requirements-base.txt
torch
torchvision
-e .

View File

@ -1,8 +1,6 @@
-r environments-and-requirements/requirements-base.txt
# Get hardware-appropriate torch/torchvision
--extra-index-url https://download.pytorch.org/whl/cu116 --trusted-host https://download.pytorch.org
gfpgan
basicsr
torch==1.12.1
torchvision==0.13.1
-e .

48
installer/create_installer.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
cd "$(dirname "$0")"
VERSION=$(grep ^VERSION ../setup.py | awk '{ print $3 }' | sed "s/'//g" )
echo "Be certain that you're in the 'installer' directory before continuing."
read -p "Press any key to continue, or CTRL-C to exit..."
echo Building installer zip fles for InvokeAI v$VERSION
# get rid of any old ones
rm *.zip
rm -rf InvokeAI-Installer
mkdir InvokeAI-Installer
cp -pr ../environments-and-requirements templates readme.txt InvokeAI-Installer/
mkdir InvokeAI-Installer/templates/rootdir
cp -pr ../configs InvokeAI-Installer/templates/rootdir/
mkdir InvokeAI-Installer/templates/rootdir/{outputs,embeddings,models}
cp install.sh.in InvokeAI-Installer/install.sh
chmod a+rx InvokeAI-Installer/install.sh
zip -r InvokeAI-installer-$VERSION-linux.zip InvokeAI-Installer
zip -r InvokeAI-installer-$VERSION-mac.zip InvokeAI-Installer
# now do the windows installer
rm InvokeAI-Installer/install.sh
cp install.bat.in InvokeAI-Installer/install.bat
cp WinLongPathsEnabled.reg InvokeAI-Installer/
# this gets rid of the "-e ." at the end of the windows requirements file
# because it is easier to do it now than in the .bat install script
egrep -v '^-e .' InvokeAI-Installer/environments-and-requirements/requirements-win-colab-cuda.txt >requirements.txt
mv requirements.txt InvokeAI-Installer/environments-and-requirements/requirements-win-colab-cuda.txt
zip -r InvokeAI-installer-$VERSION-windows.zip InvokeAI-Installer
# clean up
rm -rf InvokeAI-Installer
exit 0

215
installer/install.bat.in Normal file
View File

@ -0,0 +1,215 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
@rem This script requires the user to install Python 3.9 or higher. All other
@rem requirements are downloaded as needed.
@rem change to the script's directory
PUSHD "%~dp0"
set "no_cache_dir=--no-cache-dir"
if "%1" == "use-cache" (
set "no_cache_dir="
)
@rem Config
@rem this should be changed to the tagged release!
@rem set INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/main.zip
set INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/refs/tags/2.2.4-rc1.zip
set INSTRUCTIONS=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/
set TROUBLESHOOTING=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting
set PYTHON_URL=https://www.python.org/downloads/windows/
set MINIMUM_PYTHON_VERSION=3.9.0
set PYTHON_URL=https://www.python.org/downloads/release/python-3109/
set err_msg=An error has occurred and the script could not continue.
@rem --------------------------- Intro -------------------------------
echo This script will install InvokeAI and its dependencies. Before you start,
echo please make sure to do the following:
echo 1. Install python 3.9 or higher.
echo 2. Double-click on the file WinLongPathsEnabled.reg in order to
echo enable long path support on your system.
echo 3. Some users have found they need to install the Visual C++ core
echo libraries or else they experience DLL loading problems at the end of the install.
echo Visual C++ is very likely already installed on your system, but if you get DLL
echo issues, please download and install the libraries by going to:
echo https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170
echo.
echo See %INSTRUCTIONS% for more details.
echo.
pause
@rem ---------------------------- check Python version ---------------
echo ***** Checking and Updating Python *****
call python --version >.tmp1 2>.tmp2
if %errorlevel% == 1 (
set err_msg=Please install Python 3.9 or higher. See %INSTRUCTIONS% for details.
goto err_exit
)
for /f "tokens=2" %%i in (.tmp1) do set python_version=%%i
if "%python_version%" == "" (
set err_msg=No python was detected on your system. Please install Python version %MINIMUM_PYTHON_VERSION% or higher. We recommend Python 3.10.9 from %PYTHON_URL%
goto err_exit
)
call :compareVersions %MINIMUM_PYTHON_VERSION% %python_version%
if %errorlevel% == 1 (
set err_msg=Your version of Python is too low. You need at least %MINIMUM_PYTHON_VERSION% but you have %python_version%. We recommend Python 3.10.9 from %PYTHON_URL%
goto err_exit
)
@rem Cleanup
del /q .tmp1 .tmp2
echo Updating PIP...
call python -m pip install --no-warn-script-location -q --upgrade pip
@rem --------------------- Get the requirements file ------------
echo.
echo Setting up requirements file for your system.
copy /y environments-and-requirements\requirements-win-colab-cuda.txt .\requirements.txt
@rem --------------------- Get the root directory for installation ------------
set rootdir=""
set response=""
set selection=""
:pick_rootdir
if %rootdir% neq "" goto :done
set /p selection=Select the path to install InvokeAI's directory into [%UserProfile%]:
if %selection% == "" set selection=%UserProfile%
set dest=%selection%\invokeai
if exist %dest% (
set response=y
set /p response=The directory %dest% exists. Do you wish to resume install from a previous attempt? [Y/n]:
if !response! == "" set response=y
if /I !response! == y (set rootdir=%dest%) else (goto :pick_rootdir)
) else (
set rootdir=!dest!
)
set response=y
set /p response="You have chosen to install InvokeAI into %rootdir%. OK? [Y/n]: "
if !response! == "" set response=y
if /I !response! neq y set rootdir=""
goto :pick_rootdir
:done
@rem ---------------------- Initialize the runtime directory ---------------------
echo.
echo *** Creating Runtime Directory %rootdir% ***
if not exist %rootdir% mkdir %rootdir%
@rem for unknown reasons the mkdir works but returns an error code
if not exist %rootdir% (
set err_msg=Could not create the directory %rootdir%. Please check the directory's permissions and try again.
goto :err_exit
)
echo Successful.
@rem --------------------------- Create and populate .venv ---------------------------
echo.
echo ** Creating Virtual Environment for InvokeAI **
call python -mvenv %rootdir%\.venv
if %errorlevel% neq 0 (
set err_msg=Could not create virtual environment %rootdir%\.venv. Please check the directory's permissions and try again.
goto :err_exit
)
echo Successful.
echo.
echo *** Installing InvokeAI Requirements ***
call %rootdir%\.venv\Scripts\activate.bat
copy environments-and-requirements\requirements-win-colab-cuda.txt .\requirements.txt
call python -mpip install -r requirements.txt
if %errorlevel% neq 0 (
set err_msg=Installation of requirements failed. See above for errors and check %TROUBLESHOOTING% for potential solutions.
goto :err_exit
)
echo Installation successful.
echo.
echo *** Installing InvokeAI Modules and Executables ***
call python -mpip install %INVOKE_AI_SRC%
if %errorlevel% neq 0 (
set err_msg=Installation of InvokeAI failed. See above for errors and check %TROUBLESHOOTING% for potential solutions.
goto :err_exit
)
echo Installation successful.
@rem --------------------------- Set up the root directory ---------------------------
xcopy /E /Y .\templates\rootdir %rootdir%
PUSHD "%rootdir%"
call .venv\Scripts\python .venv\Scripts\configure_invokeai.py --root="%rootdir%"
if %errorlevel% neq 0 (
set err_msg=Configuration failed. See above for error messages and check %TROUBLESHOOTING% for potential solutions.
goto :err_exit
)
POPD
copy .\templates\invoke.bat.in %rootdir%\invoke.bat
copy .\templates\update.bat.in %rootdir%\update.bat
@rem so that update.bat works
mkdir %rootdir%\environments-and-requirements
xcopy /I /Y .\environments-and-requirements %rootdir%\environments-and-requirements
copy .\requirements.txt %rootdir%\requirements.txt
echo.
echo ***** Finished configuration *****
echo All done. Execute the file %rootdir%\invoke.bat to start InvokeAI.
pause
deactivate
exit
@rem ------------------------ Subroutines ---------------
@rem routine to do comparison of semantic version numbers
@rem found at https://stackoverflow.com/questions/15807762/compare-version-numbers-in-batch-file
:compareVersions
::
:: Compares two version numbers and returns the result in the ERRORLEVEL
::
:: Returns 1 if version1 > version2
:: 0 if version1 = version2
:: -1 if version1 < version2
::
:: The nodes must be delimited by . or , or -
::
:: Nodes are normally strictly numeric, without a 0 prefix. A letter suffix
:: is treated as a separate node
::
setlocal enableDelayedExpansion
set "v1=%~1"
set "v2=%~2"
call :divideLetters v1
call :divideLetters v2
:loop
call :parseNode "%v1%" n1 v1
call :parseNode "%v2%" n2 v2
if %n1% gtr %n2% exit /b 1
if %n1% lss %n2% exit /b -1
if not defined v1 if not defined v2 exit /b 0
if not defined v1 exit /b -1
if not defined v2 exit /b 1
goto :loop
:parseNode version nodeVar remainderVar
for /f "tokens=1* delims=.,-" %%A in ("%~1") do (
set "%~2=%%A"
set "%~3=%%B"
)
exit /b
:divideLetters versionVar
for %%C in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do set "%~1=!%~1:%%C=.%%C!"
exit /b
:err_exit
echo %err_msg%
echo The installer will exit now.
pause
exit /b

216
installer/install.sh.in Normal file
View File

@ -0,0 +1,216 @@
#!/usr/bin/env bash
# ensure we're in the correct folder in case user's CWD is somewhere else
scriptdir=$(dirname "$0")
cd "$scriptdir"
# make sure we are not already in a venv
# (don't need to check status)
deactivate >/dev/null 2>&1
# this should be changed to the tagged release!
INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/refs/tags/2.2.4-rc1.zip
INSTRUCTIONS=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/
TROUBLESHOOTING=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting
MINIMUM_PYTHON_VERSION=3.9.0
set -euo pipefail
IFS=$'\n\t'
function _err_exit {
if test "$1" -ne 0
then
echo -e "Error code $1; Error caught was '$2'"
if [ "$OS_NAME" == "osx" ]; then
echo "Something went wrong while installing InvokeAI and/or its requirements."
echo "You may need to use the Xcode command line tools to proceed. See step number 3 of"
echo "https://invoke-ai.github.io/InvokeAI/INSTALL_SOURCE#walk_through for"
echo "installation instructions and then run this script again."
else
echo "Something went wrong while installing InvokeAI and/or its requirements."
echo "See https://invoke-ai.github.io/InvokeAI/INSTALL_SOURCE#troubleshooting for troubleshooting"
echo "tips, or visit https://invoke-ai.github.io/InvokeAI/#installation for alternative"
echo "installation methods"
fi
read -p "Press any key to exit..."
exit
fi
}
function readinput() {
local CLEAN_ARGS=""
while [[ $# -gt 0 ]]; do
local i="$1"
case "$i" in
"-i")
if read -i "default" 2>/dev/null <<< "test"; then
CLEAN_ARGS="$CLEAN_ARGS -i \"$2\""
fi
shift
shift
;;
"-p")
CLEAN_ARGS="$CLEAN_ARGS -p \"$2\""
shift
shift
;;
*)
CLEAN_ARGS="$CLEAN_ARGS $1"
shift
;;
esac
done
eval read $CLEAN_ARGS
}
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
echo "InvokeAI simple installer..."
echo ""
echo "Some of the installation steps take a long time to run. Please be patient."
echo "If the script appears to hang for more than 10 minutes, please interrupt with control-C and retry."
read -n 1 -s -r -p "<Press any key to start the install>"
echo ""
OS_NAME=$(uname -s)
case "${OS_NAME}" in
Linux*) OS_NAME="linux";;
Darwin*) OS_NAME="osx";;
*) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit
esac
OS_ARCH=$(uname -m)
case "${OS_ARCH}" in
x86_64*) OS_ARCH="64";;
arm64*) OS_ARCH="arm64";;
*) echo "Unknown system architecture: $OS_ARCH! This script runs only on x86_64 or arm64" && exit
esac
echo "Installing for $OS_NAME-$OS_ARCH"
# confirm that python is installed and is up to date
PYTHON=""
for candidate in python3.10 python3.9 python3 python python3.11 ; do
if ppath=`which $candidate`; then
python_version=$($ppath -V | awk '{ print $2 }')
if [ $(version $python_version) -ge $(version "$MINIMUM_PYTHON_VERSION") ]; then
PYTHON=$ppath
echo Python $python_version found at $PYTHON
break
fi
fi
done
if [ -z "$PYTHON" ]; then
echo "A suitable Python interpreter could not be found"
echo "Please install Python 3.9 or higher before running this script. See instructions at $INSTRUCTIONS for help."
read -p "Press any key to exit"
exit -1
fi
if [ "$OS_NAME" == "osx" ]; then
xcode_path=$(xcode-select --print-path)
_err_exit $? "xcode_path command not found"
export CPPFLAGS="-I$xcode_path/Library/Frameworks/Python3.framework/Versions/Current/Headers"
echo "Will compile wheels with CPPFLAGS=$CPPFLAGS"
fi
ROOTDIR=""
while [ "$ROOTDIR" == "" ]
do
echo
readinput -e -p "Select your preferred location for the 'invokeai' directory [$HOME]: " -i $HOME input
ROOTDIR=${input:=$HOME}/invokeai
read -e -p "InvokeAI will be installed into $ROOTDIR. OK? [y]: " input
RESPONSE=${input:='y'}
if [ "$RESPONSE" == 'y' ]; then
if [ -e $ROOTDIR ]; then
echo
read -e -p "Directory $ROOTDIR already exists. Do you want to resume an interrupted install? [y]: " input
RESPONSE=${input:='y'}
if [ "$RESPONSE" != 'y' ]; then
ROOTDIR=""
fi
else
mkdir -p $ROOTDIR
if [ $? -ne 0 ]; then
echo "Could not create $ROOTDIR. Try again with a different install location."
ROOTDIR=""
fi
fi
else
ROOTDIR=""
fi
done
#--------------------------------------------------------------------------------
echo
echo "** Creating Virtual Environment for InvokeAI **"
$PYTHON -mpip install --upgrade pip
$PYTHON -mvenv $ROOTDIR/.venv
_err_exit $? "Python failed to create virtual environment $ROOTDIR/.venv. Please see $TROUBLESHOOTING for help."
#--------------------------------------------------------------------------------
echo
echo "** Activating Virtual Environment for InvokeAI **"
source $ROOTDIR/.venv/bin/activate
_err_exit $? "Failed to activate virtual evironment $ROOTDIR/.venv. Please see $TROUBLESHOOTING for help."
PYTHON=$ROOTDIR/.venv/bin/python
#--------------------------------------------------------------------------------
echo
echo "*** Installing InvokeAI Dependencies ***"
if [ "$OS_NAME" == "osx" ]; then
echo "macOS detected. Installing MPS and CPU support."
egrep -v '^-e .' environments-and-requirements/requirements-mac-mps-cpu.txt >requirements.txt
else
if (lsmod | grep amdgpu) &>/dev/null ; then
echo "Linux system with AMD GPU driver detected. Installing ROCm and CPU support"
egrep -v '^-e .' environments-and-requirements/requirements-lin-amd.txt >requirements.txt
else
echo "Linux system detected. Installing CUDA and CPU support."
egrep -v '^-e .' environments-and-requirements/requirements-lin-cuda.txt >requirements.txt
fi
fi
$PYTHON -mpip install -r requirements.txt
_err_exit $? "Failed to install InvokeAI's dependencies."
#--------------------------------------------------------------------------------
echo
echo "*** Installing InvokeAI Modules and Executables ***"
$PYTHON -mpip install $INVOKE_AI_SRC
_err_exit $? "Installation of InvokeAI failed."
#--------------------------------------------------------------------------------
echo " *** Setting Up Root Directory $ROOTDIR *** "
cp -pr templates/rootdir/* $ROOTDIR/
cp templates/invoke.sh.in $ROOTDIR/invoke.sh
chmod a+rx $ROOTDIR/invoke.sh
cp templates/update.sh.in $ROOTDIR/update.sh
chmod a+rx $ROOTDIR/update.sh
# This allows the updater to work!
cp -pr environments-and-requirements requirements.txt $ROOTDIR/
#--------------------------------------------------------------------------------
echo
echo "*** Confguring InvokeAI ***"
pushd $ROOTDIR
./.venv/bin/configure_invokeai.py --root=$ROOTDIR
_err_exit $? "Initial configuration failed. Please see above error messages and $TROUBLESHOOTING for help."
#--------------------------------------------------------------------------------
popd
cp templates/invoke.sh.in $ROOTDIR/invoke.sh
chmod a+rx $ROOTDIR/invoke.sh
cp templates/update.sh.in $ROOTDIR/update.sh
chmod a+rx $ROOTDIR/update.sh
echo "You may now run InvokeAI by entering the directory $ROOTDIR and running invoke.sh"

52
installer/readme.txt Normal file
View File

@ -0,0 +1,52 @@
InvokeAI
Project homepage: https://github.com/invoke-ai/InvokeAI
Preparations:
You will need to install Python 3.9 or higher for this installer
to work. Instructions are given here:
https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/
Before you start the installer, please open up your system's command
line window (Terminal or Command) and type the commands:
python --version
If all is well, it will print "Python 3.X.X", where the version number
is at least 3.9.1
If this works, check the version of the Python package manager, pip:
pip --version
You should get a message that indicates that the pip package
installer was derived from Python 3.9 or 3.10. For example:
"pip 22.3.1 from /usr/bin/pip (python 3.9)"
Long Paths on Windows:
If you are on Windows, you will need to enable Windows Long Paths to
run InvokeAI successfully. If you're not sure what this is, you
almost certainly need to do this.
Simply double-click the "WinLongPathsEnabled.reg" file located in
this directory, and approve the Windows warnings. Note that you will
need to have admin privileges in order to do this.
Launching the installer:
Windows: double-click the 'install.bat' file (while keeping it inside
the InvokeAI-Installer folder).
Linux and Mac: Please open the terminal application and run
'./install.sh' (while keeping it inside the InvokeAI-Installer
folder).
The installer will create a directory named "invokeai" in the folder
of your choice. This directory contains everything you need to run
invokeai. Once InvokeAI is up and running, you may delete the
InvokeAI-Installer folder at your convenience.
For more information, please see
https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/

View File

@ -0,0 +1,37 @@
@echo off
PUSHD "%~dp0"
setlocal
call .venv\Scripts\activate.bat
set INVOKEAI_ROOT=.
echo Do you want to generate images using the
echo 1. command-line
echo 2. browser-based UI
echo 3. open the developer console
set /P restore="Please enter 1, 2 or 3: "
IF /I "%restore%" == "1" (
echo Starting the InvokeAI command-line..
python .venv\Scripts\invoke.py %*
) ELSE IF /I "%restore%" == "2" (
echo Starting the InvokeAI browser-based UI..
python .venv\Scripts\invoke.py --web %*
) ELSE IF /I "%restore%" == "3" (
echo Developer Console
echo Python command is:
where python
echo Python version is:
python --version
echo *************************
echo You are now in the system shell, with the local InvokeAI Python virtual environment activated,
echo so that you can troubleshoot this InvokeAI installation as necessary.
echo *************************
echo *** Type `exit` to quit this shell and deactivate the Python virtual environment ***
call cmd /k
) ELSE (
echo Invalid selection
pause
exit /b
)
endlocal

View File

@ -1,14 +1,14 @@
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
set -eu
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$INSTALL_ENV_DIR/bin:$PATH"; fi
# ensure we're in the correct folder in case user's CWD is somewhere else
scriptdir=$(dirname "$0")
cd "$scriptdir"
CONDA_BASEPATH=$(conda info --base)
source "$CONDA_BASEPATH/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script)
. .venv/bin/activate
conda activate invokeai
export INVOKEAI_ROOT="$scriptdir"
# set required env var for torch on mac MPS
if [ "$(uname -s)" == "Darwin" ]; then
@ -22,8 +22,8 @@ if [ "$0" != "bash" ]; then
echo "3. open the developer console"
read -p "Please enter 1, 2, or 3: " yn
case $yn in
1 ) printf "\nStarting the InvokeAI command-line..\n"; python scripts/invoke.py $*;;
2 ) printf "\nStarting the InvokeAI browser-based UI..\n"; python scripts/invoke.py --web $*;;
1 ) printf "\nStarting the InvokeAI command-line..\n"; .venv/bin/python .venv/bin/invoke.py $*;;
2 ) printf "\nStarting the InvokeAI browser-based UI..\n"; .venv/bin/python .venv/bin/invoke.py --web $*;;
3 ) printf "\nDeveloper Console:\n"; file_name=$(basename "${BASH_SOURCE[0]}"); bash --init-file "$file_name";;
* ) echo "Invalid selection"; exit;;
esac

View File

@ -0,0 +1,52 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
PUSHD "%~dp0"
set INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/main.zip
set arg=%1
if "%arg%" neq "" (
if "%arg:~0,4%" neq "http" (
echo Usage: update.bat ^<release URL^>.zip
echo Updates InvokeAI to use the indicated version of the code base.
echo Find the zip file for the release you want, and pass it as the argument.
echo For example update.sh https://github.com/invoke-ai/InvokeAI/archive/refs/tags/v2.2.4.zip
echo.
echo If no argument provided then will install the most recent development version, equivalent to
echo update.bat https://github.com/invoke-ai/InvokeAI/archive/main.zip
exit /b
) else (
set INVOKE_AI_SRC=%arg%
)
)
call .venv\Scripts\activate.bat
echo This script will update InvokeAI and all its dependencies to !INVOKE_AI_SRC!.
echo If you do not want to do this, press control-C now!
pause
call pip install -r requirements.txt
if %errorlevel% neq 0 (
echo Installation of requirements failed. See https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting for suggestions.
exit /b
)
call pip install !INVOKE_AI_SRC!
if %errorlevel% neq 0 (
echo Installation of InvokeAI failed. See https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting for suggestions.
exit /b
)
call .venv\Scripts\python .venv\Scripts\configure_invokeai.py --root="%rootdir%"
if %errorlevel% neq 0 (
echo Configuration InvokeAI failed. See https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting for suggestions.
exit /b
)
echo "Press any key to continue"
pause
endlocal

View File

@ -0,0 +1,52 @@
#!/bin/bash
set -eu
if [ $# -ge 1 ] && [ "${1:0:4}" != "http" ]; then
echo "Usage: update.sh <release URL>.zip"
echo "Updates InvokeAI to use the indicated version of the code base."
echo "Find the zip file for the release you want, and pass it as the argument."
echo "For example update.sh https://github.com/invoke-ai/InvokeAI/archive/refs/tags/v2.2.3.zip"
echo ""
echo "If no argument provided then will install the most recent development version, equivalent to"
echo "update.sh https://github.com/invoke-ai/InvokeAI/archive/main.zip"
exit -1
fi
INVOKE_AI_SRC=${1:-https://github.com/invoke-ai/InvokeAI/archive/main.zip}
# ensure we're in the correct folder in case user's CWD is somewhere else
scriptdir=$(dirname "$0")
cd "$scriptdir"
function _err_exit {
if test "$1" -ne 0
then
echo "Something went wrong while installing InvokeAI and/or its requirements."
echo "Update cannot continue. Please report this error to https://github.com/invoke-ai/InvokeAI/issues"
echo -e "Error code $1; Error caught was '$2'"
read -p "Press any key to exit..."
exit
fi
}
echo This script will update InvokeAI and all its dependencies from $INVOKE_AI_SRC.
echo If you do not want to do this, press control-C now!
read -p "Press any key to continue, or CTRL-C to exit..."
. .venv/bin/activate
pip install -r requirements.txt
_err_exit $? "The pip program failed to install InvokeAI's requirements."
pip install $INVOKE_AI_SRC
_err_exit $? "The pip program failed to install InvokeAI."
python .venv/bin/configure_invoke.py
_err_exit $? "The configure script failed to run successfully."

View File

@ -131,7 +131,6 @@ gr = Generate(
"""
class Generate:
"""Generate class
Stores default values for multiple configuration items

View File

@ -46,7 +46,6 @@ def main():
args.max_loaded_models = 1
# alert - setting globals here
Globals.root = os.path.expanduser(args.root_dir or os.environ.get('INVOKEAI_ROOT') or os.path.abspath('.'))
Globals.try_patchmatch = args.patchmatch
print(f'>> InvokeAI runtime directory is "{Globals.root}"')

View File

@ -0,0 +1 @@
__version__='2.2.4'

View File

@ -119,7 +119,7 @@ PRECISION_CHOICES = [
# is there a way to pick this up during git commits?
APP_ID = 'invoke-ai/InvokeAI'
APP_VERSION = 'v2.2.3'
APP_VERSION = 'v2.2.4'
class ArgFormatter(argparse.RawTextHelpFormatter):
# use defined argument order to display usage
@ -172,14 +172,20 @@ class Args(object):
'''Parse the shell switches and store.'''
try:
sysargs = sys.argv[1:]
initfile = os.path.expanduser(Globals.initfile)
# pre-parse to get the root directory; ignore the rest
switches = self._arg_parser.parse_args(sysargs)
Globals.root = switches.root_dir or Globals.root
# now use root directory to find the init file
initfile = os.path.expanduser(os.path.join(Globals.root,Globals.initfile))
legacyinit = os.path.expanduser('~/.invokeai')
if os.path.exists(initfile):
print(f'>> Initialization file {initfile} found. Loading...')
sysargs.insert(0,f'@{initfile}')
else:
from ldm.invoke.CLI import emergency_model_reconfigure
emergency_model_reconfigure()
sys.exit(-1)
elif os.path.exists(legacyinit):
print(f'>> WARNING: Old initialization file found at {legacyinit}. This location is deprecated. Please move it to {Globals.root}/invokeai.init.')
sysargs.insert(0,f'@{legacyinit}')
self._arg_switches = self._arg_parser.parse_args(sysargs)
return self._arg_switches
except Exception as e:
@ -411,7 +417,7 @@ class Args(object):
model_group.add_argument(
'--root_dir',
default=None,
help='Path to directory containing "models", "outputs" and "configs". If not present will try to read from ~/.invokeai and then from environment variable INVOKEAI_ROOT. Defaults to the current directory as a last resort.',
help='Path to directory containing "models", "outputs" and "configs". If not present will read from environment variable INVOKEAI_ROOT. Defaults to ~/invokeai.',
)
model_group.add_argument(
'--config',

View File

@ -16,10 +16,10 @@ from argparse import Namespace
Globals = Namespace()
# This is usually overwritten by the command line and/or environment variables
Globals.root = '.'
Globals.root = os.environ.get('INVOKEAI_ROOT') or os.path.expanduser('~/invokeai')
# Where to look for the initialization file
Globals.initfile = os.path.expanduser('~/.invokeai')
Globals.initfile = 'invokeai.init'
# Awkward workaround to disable attempted loading of pypatchmatch
# which is causing CI tests to error out.

View File

@ -40,7 +40,7 @@ Dataset_path = './configs/INITIAL_MODELS.yaml'
Default_config_file = './configs/models.yaml'
SD_Configs = './configs/stable-diffusion'
assert os.path.exists(Dataset_path),"The configs directory cannot be found. Please run this script from within the InvokeAI distribution directory, or from within the invokeai runtime directory."
assert os.path.exists(Dataset_path),"The configs directory cannot be found. Please run this script from within the invokeai runtime directory."
Datasets = OmegaConf.load(Dataset_path)
completer = generic_completer(['yes','no'])
@ -234,7 +234,7 @@ This involves a few easy steps.
"Role" should be "read").
Now copy the token to your clipboard and paste it at the prompt. Windows
users can paste with right-click.
users can paste with right-click or Ctrl-Shift-V.
Token: '''
)
access_token = getpass_asterisk.getpass_asterisk()
@ -580,22 +580,7 @@ def get_root(root:str=None)->str:
elif os.environ.get('INVOKEAI_ROOT'):
return os.environ.get('INVOKEAI_ROOT')
else:
init_file = os.path.expanduser(Globals.initfile)
if not os.path.exists(init_file):
return None
# if we get here, then we read from initfile
root = None
with open(init_file, 'r') as infile:
lines = infile.readlines()
for l in lines:
if re.search('\s*#',l): # ignore comments
continue
match = re.search('--root\s*=?\s*"?([^"]+)"?',l)
if match:
root = match.groups()[0]
root = root.strip()
return root
return Globals.root
#-------------------------------------
def select_root(root:str, yes_to_all:bool=False):
@ -626,18 +611,16 @@ def initialize_rootdir(root:str,yes_to_all:bool=False):
print(f'** INITIALIZING INVOKEAI RUNTIME DIRECTORY **')
root_selected = False
while not root_selected:
root = select_root(root,yes_to_all)
outputs = select_outputs(root,yes_to_all)
Globals.root = os.path.abspath(root)
outputs = outputs if os.path.isabs(outputs) else os.path.abspath(os.path.join(Globals.root,outputs))
print(f'\nInvokeAI models and configuration files will be placed into "{root}" and image outputs will be placed into "{outputs}".')
print(f'\nInvokeAI image outputs will be placed into "{outputs}".')
if not yes_to_all:
root_selected = yes_or_no('Accept these locations?')
root_selected = yes_or_no('Accept this location?')
else:
root_selected = True
print(f'\nYou may change the chosen directories at any time by editing the --root and --outdir options in "{Globals.initfile}",')
print(f'\nYou may change the chosen output directory at any time by editing the --outdir options in "{Globals.initfile}",')
print(f'You may also change the runtime directory by setting the environment variable INVOKEAI_ROOT.\n')
enable_safety_checker = True
@ -651,6 +634,7 @@ def initialize_rootdir(root:str,yes_to_all:bool=False):
print('It can be selectively enabled at run time with --nsfw_checker, and disabled with --no-nsfw_checker.')
print('The following option will set whether the checker is enabled by default. Like other options, you can')
print(f'change this setting later by editing the file {Globals.initfile}.')
print(f'The NSFW checker is a memory hog. If you have less than 6 GB of VRAM answer NO to this option.')
enable_safety_checker = yes_or_no('Enable the NSFW checker by default?',enable_safety_checker)
print('\nThe next choice selects the sampler to use by default. Samplers have different speed/performance')
@ -679,7 +663,7 @@ def initialize_rootdir(root:str,yes_to_all:bool=False):
shutil.copytree(src,dest,dirs_exist_ok=True)
os.makedirs(outputs, exist_ok=True)
init_file = os.path.expanduser(Globals.initfile)
init_file = os.path.join(Globals.root,Globals.initfile)
print(f'Creating the initialization file at "{init_file}".\n')
with open(init_file,'w') as f:
@ -688,9 +672,6 @@ def initialize_rootdir(root:str,yes_to_all:bool=False):
# Feel free to edit. If anything goes wrong, you can re-initialize this file by deleting
# or renaming it and then running configure_invokeai.py again.
# The --root option below points to the folder in which InvokeAI stores its models, configs and outputs.
--root="{Globals.root}"
# the --outdir option controls the default location of image files.
--outdir="{outputs}"
@ -757,7 +738,7 @@ def main():
# We check for to see if the runtime directory is correctly initialized.
if Globals.root == '' \
or not os.path.exists(os.path.join(Globals.root,'configs/stable-diffusion/v1-inference.yaml')):
or not os.path.exists(os.path.join(Globals.root,'invokeai.init')):
initialize_rootdir(Globals.root,opt.yes_to_all)
# Optimistically try to download all required assets. If any errors occur, add them and proceed anyway.

View File

@ -6,7 +6,7 @@ from setuptools import setup, find_packages
def list_files(directory):
return [os.path.join(directory,x) for x in os.listdir(directory) if os.path.isfile(os.path.join(directory,x))]
VERSION = '2.2.0'
VERSION = '2.2.4'
DESCRIPTION = ('An implementation of Stable Diffusion which provides various new features'
' and options to aid the image generation process')
LONG_DESCRIPTION = ('This version of Stable Diffusion features a slick WebGUI, an'

View File

@ -1,27 +0,0 @@
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
VERSION='2.2.3'
# make the installer zip for linux and mac
rm -rf invokeAI
mkdir -p invokeAI
cp install.sh.in invokeAI/install.sh
chmod a+x invokeAI/install.sh
cp readme.txt invokeAI
zip -r invokeAI-src-installer-$VERSION-linux.zip invokeAI
zip -r invokeAI-src-installer-$VERSION-mac.zip invokeAI
# make the installer zip for windows
rm -rf invokeAI
mkdir -p invokeAI
cp install.bat.in invokeAI/install.bat
cp readme.txt invokeAI
cp WinLongPathsEnabled.reg invokeAI
zip -r invokeAI-src-installer-$VERSION-windows.zip invokeAI
rm -rf invokeAI
echo "The installer zips are ready to be distributed.."

View File

@ -1,127 +0,0 @@
@echo off
@rem This script will install git and conda (if not found on the PATH variable)
@rem using micromamba (an 8mb static-linked single-file binary, conda replacement).
@rem For users who already have git and conda, this step will be skipped.
@rem Next, it'll checkout the project's git repo, if necessary.
@rem Finally, it'll create the conda environment and configure InvokeAI.
@rem This enables a user to install this project without manually installing conda and git.
@rem change to the script's directory
PUSHD "%~dp0"
echo "InvokeAI source installer..."
echo ""
echo "Some of the installation steps take a long time to run. Please be patient."
echo "If the script appears to hang for more than 10 minutes, please interrupt with control-C and retry."
echo "<Press any key to start the install process>"
pause
echo ""
@rem config
set MAMBA_ROOT_PREFIX=%cd%\installer_files\mamba
set INSTALL_ENV_DIR=%cd%\installer_files\env
set MICROMAMBA_DOWNLOAD_URL=https://github.com/cmdr2/stable-diffusion-ui/releases/download/v1.1/micromamba.exe
set REPO_URL=https://github.com/invoke-ai/InvokeAI.git
set umamba_exists=F
@rem Change the download URL to an InvokeAI repo's release URL
@rem figure out whether git and conda needs to be installed
if exist "%INSTALL_ENV_DIR%" set PATH=%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts;%INSTALL_ENV_DIR%\Library\usr\bin;%PATH%
set PACKAGES_TO_INSTALL=
call conda --version >.tmp1 2>.tmp2
if "%ERRORLEVEL%" NEQ "0" set PACKAGES_TO_INSTALL=%PACKAGES_TO_INSTALL% conda
call git --version >.tmp1 2>.tmp2
if "%ERRORLEVEL%" NEQ "0" set PACKAGES_TO_INSTALL=%PACKAGES_TO_INSTALL% git
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version >.tmp1 2>.tmp2
if "%ERRORLEVEL%" EQU "0" set umamba_exists=T
@rem (if necessary) install git and conda into a contained environment
if "%PACKAGES_TO_INSTALL%" NEQ "" (
@rem download micromamba
if "%umamba_exists%" == "F" (
echo "Downloading micromamba from %MICROMAMBA_DOWNLOAD_URL% to %MAMBA_ROOT_PREFIX%\micromamba.exe"
mkdir "%MAMBA_ROOT_PREFIX%"
call curl -L "%MICROMAMBA_DOWNLOAD_URL%" > "%MAMBA_ROOT_PREFIX%\micromamba.exe"
@rem test the mamba binary
echo Micromamba version:
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version
)
@rem create the installer env
if not exist "%INSTALL_ENV_DIR%" (
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" create -y --prefix "%INSTALL_ENV_DIR%"
)
echo "Packages to install:%PACKAGES_TO_INSTALL%"
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" install -y --prefix "%INSTALL_ENV_DIR%" -c conda-forge %PACKAGES_TO_INSTALL%
if not exist "%INSTALL_ENV_DIR%" (
echo "There was a problem while installing%PACKAGES_TO_INSTALL% using micromamba. Cannot continue."
pause
exit /b
)
)
set PATH=%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts;%INSTALL_ENV_DIR%\Library\usr\bin;%PATH%
@rem get the repo (and load into the current directory)
if not exist ".git" (
call git init
call git config --local init.defaultBranch main
call git remote add origin %REPO_URL%
call git fetch
call git checkout origin/main -ft
)
@rem activate the base env
call conda activate
@rem create the environment
call conda env remove -n invokeai
copy environments-and-requirements\environment-win-cuda.yml environment.yml
call conda env create
if "%ERRORLEVEL%" NEQ "0" (
echo ""
echo "Something went wrong while installing Python libraries and cannot continue."
echo "See https://invoke-ai.github.io/InvokeAI/INSTALL_SOURCE#troubleshooting for troubleshooting"
echo "tips, or visit https://invoke-ai.github.io/InvokeAI/#installation for alternative"
echo "installation methods"
pause
exit /b
)
copy source_installer\invoke.bat.in .\invoke.bat
copy source_installer\update.bat.in .\update.bat
call conda activate invokeai
@rem call configure script
call python scripts\configure_invokeai.py
if "%ERRORLEVEL%" NEQ "0" (
echo ""
echo "The configure script crashed or was cancelled."
echo "InvokeAI is not ready to run. To run preload_models.py again,"
echo "run the command 'update.bat' in this directory."
echo "Press any key to continue"
pause
exit /b
)
@rem tell the user their next steps
echo ""
echo "* InvokeAI installed successfully *"
echo "You can now start generating images by double-clicking the 'invoke.bat' file (inside this folder)
echo "Press any key to continue"
pause
exit /b

View File

@ -1,152 +0,0 @@
#!/usr/bin/env bash
# This script will install git and conda (if not found on the PATH variable)
# using micromamba (an 8mb static-linked single-file binary, conda replacement).
# For users who already have git and conda, this step will be skipped.
# Next, it'll checkout the project's git repo, if necessary.
# Finally, it'll create the conda environment and configure InvokeAI.
# This enables a user to install this project without manually installing conda and git.
cd "$(dirname "${BASH_SOURCE[0]}")"
echo "InvokeAI source installer..."
echo ""
echo "Some of the installation steps take a long time to run. Please be patient."
echo "If the script appears to hang for more than 10 minutes, please interrupt with control-C and retry."
read -n 1 -s -r -p "<Press any key to start the install>"
echo ""
OS_NAME=$(uname -s)
case "${OS_NAME}" in
Linux*) OS_NAME="linux";;
Darwin*) OS_NAME="osx";;
*) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit
esac
OS_ARCH=$(uname -m)
case "${OS_ARCH}" in
x86_64*) OS_ARCH="64";;
arm64*) OS_ARCH="arm64";;
*) echo "Unknown system architecture: $OS_ARCH! This script runs only on x86_64 or arm64" && exit
esac
# https://mamba.readthedocs.io/en/latest/installation.html
if [ "$OS_NAME" == "linux" ] && [ "$OS_ARCH" == "arm64" ]; then OS_ARCH="aarch64"; fi
# config
export MAMBA_ROOT_PREFIX="$(pwd)/installer_files/mamba"
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
MICROMAMBA_DOWNLOAD_URL="https://micro.mamba.pm/api/micromamba/${OS_NAME}-${OS_ARCH}/latest"
REPO_URL="https://github.com/invoke-ai/InvokeAI.git"
umamba_exists="F"
# figure out whether git and conda needs to be installed
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$INSTALL_ENV_DIR/bin:$PATH"; fi
PACKAGES_TO_INSTALL=""
if ! $(which conda) -V &>/dev/null; then PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL conda"; fi
if ! which git &>/dev/null; then PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL git"; fi
if "$MAMBA_ROOT_PREFIX/micromamba" --version &>/dev/null; then umamba_exists="T"; fi
# (if necessary) install git and conda into a contained environment
if [ "$PACKAGES_TO_INSTALL" != "" ]; then
# download micromamba
if [ "$umamba_exists" == "F" ]; then
echo "Downloading micromamba from $MICROMAMBA_DOWNLOAD_URL to $MAMBA_ROOT_PREFIX/micromamba"
mkdir -p "$MAMBA_ROOT_PREFIX"
curl -L "$MICROMAMBA_DOWNLOAD_URL" | tar -xvjO bin/micromamba > "$MAMBA_ROOT_PREFIX/micromamba"
chmod u+x "$MAMBA_ROOT_PREFIX/micromamba"
# test the mamba binary
echo "Micromamba version:"
"$MAMBA_ROOT_PREFIX/micromamba" --version
fi
# create the installer env
if [ ! -e "$INSTALL_ENV_DIR" ]; then
"$MAMBA_ROOT_PREFIX/micromamba" create -y --prefix "$INSTALL_ENV_DIR"
fi
echo "Packages to install:$PACKAGES_TO_INSTALL"
"$MAMBA_ROOT_PREFIX/micromamba" install -y --prefix "$INSTALL_ENV_DIR" -c conda-forge $PACKAGES_TO_INSTALL
if [ ! -e "$INSTALL_ENV_DIR" ]; then
echo "There was a problem while initializing micromamba. Cannot continue."
exit
fi
fi
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$INSTALL_ENV_DIR/bin:$PATH"; fi
# get the repo (and load into the current directory)
if [ ! -e ".git" ]; then
git init
git config --local init.defaultBranch main
git remote add origin "$REPO_URL"
git fetch
git checkout origin/main -ft
fi
# create the environment
CONDA_BASEPATH=$(conda info --base)
source "$CONDA_BASEPATH/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script)
conda activate
if [ "$OS_NAME" == "osx" ]; then
echo "macOS detected. Installing MPS and CPU support."
ln -sf environments-and-requirements/environment-mac.yml environment.yml
else
if (lsmod | grep amdgpu) &>/dev/null ; then
echo "Linux system with AMD GPU driver detected. Installing ROCm and CPU support"
ln -sf environments-and-requirements/environment-lin-amd.yml environment.yml
else
echo "Linux system detected. Installing CUDA and CPU support."
ln -sf environments-and-requirements/environment-lin-cuda.yml environment.yml
fi
fi
conda env update
status=$?
if test $status -ne 0
then
if [ "$OS_NAME" == "osx" ]; then
echo "Python failed to install the environment. You may need to install"
echo "the Xcode command line tools to proceed. See step number 3 of"
echo "https://invoke-ai.github.io/InvokeAI/INSTALL_SOURCE#walk_through for"
echo "installation instructions and then run this script again."
else
echo "Something went wrong while installing Python libraries and cannot continue."
echo "See https://invoke-ai.github.io/InvokeAI/INSTALL_SOURCE#troubleshooting for troubleshooting"
echo "tips, or visit https://invoke-ai.github.io/InvokeAI/#installation for alternative"
echo "installation methods"
fi
else
cp ./source_installer/invoke.sh.in ./invoke.sh
cp ./source_installer/update.sh.in ./update.sh
chmod a+rx ./source_installer/invoke.sh.in
chmod a+rx ./source_installer/update.sh.in
conda activate invokeai
# configure
echo "Calling the configure_invokeai script"
python scripts/configure_invokeai.py
status=$?
if test $status -ne 0
then
echo "The configure_invoke.py script crashed or was cancelled."
echo "InvokeAI is not ready to run. Try again by running"
echo "update.sh in this directory."
else
# tell the user their next steps
echo "You can now start generating images by running invoke.sh (inside this folder), using ./invoke.sh"
fi
fi
conda activate invokeai

View File

@ -1,34 +0,0 @@
@echo off
REM isolate changes to environment variables so that this can be run again with restarting a cmd session
setlocal
PUSHD "%~dp0"
set INSTALL_ENV_DIR=%cd%\installer_files\env
set PATH=%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts;%INSTALL_ENV_DIR%\Library\usr\bin;%PATH%
call conda activate invokeai
echo Do you want to generate images using the
echo 1. command-line
echo 2. browser-based UI
echo 3. open the developer console
set /P restore="Please enter 1, 2 or 3: "
IF /I "%restore%" == "1" (
echo Starting the InvokeAI command-line..
python scripts\invoke.py %*
) ELSE IF /I "%restore%" == "2" (
echo Starting the InvokeAI browser-based UI..
python scripts\invoke.py --web %*
) ELSE IF /I "%restore%" == "3" (
echo Developer Console
call where python
call python --version
cmd /k
) ELSE (
echo Invalid selection
pause
exit /b
)
endlocal

View File

@ -1,16 +0,0 @@
InvokeAI
Project homepage: https://github.com/invoke-ai/InvokeAI
Installation on Windows:
You may need to enable Windows Long Paths to install InvokeAI. If you're not
sure what this is, you almost certainly need to do this. Simply double-click the
"WinLongPathsEnabled.reg" file located in this directory, and approve the Windows
warnings. Note that you will need to have admin privileges in order to do this.
Then double-click the 'install.bat' file (while keeping it inside the invokeAI folder).
Installation on Linux and Mac:
Please open the terminal, and run './install.sh' (while keeping it inside the invokeAI folder).
After installation, please run the 'invoke.bat' file (on Windows) or 'invoke.sh' file (on Linux/Mac) to start InvokeAI.

View File

@ -1,19 +0,0 @@
@echo off
set INSTALL_ENV_DIR=%cd%\installer_files\env
set PATH=%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts;%INSTALL_ENV_DIR%\Library\usr\bin;%PATH%
@rem update the repo
if exist ".git" (
call git pull
)
conda env update
conda activate invokeai
python scripts/preload_models.py
echo "Press any key to continue"
pause
exit 0

View File

@ -1,26 +0,0 @@
#!/bin/bash
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$INSTALL_ENV_DIR/bin:$PATH"; fi
# update the repo
if [ -e ".git" ]; then
git pull
fi
CONDA_BASEPATH=$(conda info --base)
source "$CONDA_BASEPATH/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script)
conda activate invokeai
OS_NAME=$(uname -s)
case "${OS_NAME}" in
Linux*) conda env update;;
Darwin*) conda env update -f environment-mac.yml;;
*) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit
esac
python scripts/preload_models.py