InvokeAI/installer/create_installer.sh
Lincoln Stein 1219c39d78
Lstein installer improvements (#1954)
* add logic for finding the root (runtime) directory

This commit fixes the root search logic to be as follows:

1) The `--root_dir` command line argument
2) The contents of environment variable INVOKEAI_ROOT
3) The VIRTUAL_ENV environment variable, plus '..'
4) $HOME/invokeai

(3) is the new feature. Since we are now recommending to install
InvokeAI and its dependencies into the .venv in the root directory,
this should be a reliable choice.

* make installer scripts more robust

This commits improves the installer .sh and .bat scripts in the following
ways:

1. They now handle folder/directory names containing spaces.
2. Pip will be installed into the .venv using the `ensurepip`
   module.

This addresses issues identified by @vargol in Issue #1941

* add --prefer-binary option to pip install

* fix unset variable crash

* add patch level to zip file name

* Fix crash introduced in #1948
2022-12-13 01:15:11 -05:00

50 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
cd "$(dirname "$0")"
VERSION=$(grep ^VERSION ../setup.py | awk '{ print $3 }' | sed "s/'//g" )
VERSION="$VERSION-p1"
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