mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
(installer) build .whl and distribute together with the installer; install from bundled .whl by default
This commit is contained in:
parent
47dbe7bc0d
commit
f1f8ce604a
54
installer/create_installer.sh
Normal file → Executable file
54
installer/create_installer.sh
Normal file → Executable file
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
VERSION=$(cd ..; python -c "from ldm.invoke import __version__ as version; print(version)")
|
VERSION=$(cd ..; python -c "from ldm.invoke import __version__ as version; print(version)")
|
||||||
@ -23,38 +25,49 @@ if [ "$RESPONSE" == 'y' ]; then
|
|||||||
git tag -fa latest
|
git tag -fa latest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ----------------------
|
||||||
|
|
||||||
|
echo Building the wheel
|
||||||
|
if [[ -v "VIRTUAL_ENV" ]]; then deactivate; fi
|
||||||
|
|
||||||
|
# install the 'build' package in the user site packages, if needed
|
||||||
|
# could be improved by using a temporary venv, but it's tiny and harmless
|
||||||
|
if [[ $(python -c 'from importlib.util import find_spec; print(find_spec("build") is None)') == "True" ]]; then
|
||||||
|
pip install --user build
|
||||||
|
fi
|
||||||
|
|
||||||
|
python -m build --wheel --outdir dist/ ../.
|
||||||
|
|
||||||
|
# ----------------------
|
||||||
|
|
||||||
echo Building installer zip fles for InvokeAI $VERSION
|
echo Building installer zip fles for InvokeAI $VERSION
|
||||||
|
|
||||||
# get rid of any old ones
|
# get rid of any old ones
|
||||||
rm *.zip
|
rm -f *.zip
|
||||||
|
|
||||||
rm -rf InvokeAI-Installer
|
rm -rf InvokeAI-Installer
|
||||||
|
|
||||||
|
# copy content
|
||||||
mkdir InvokeAI-Installer
|
mkdir InvokeAI-Installer
|
||||||
|
for f in templates *.py *.txt *.reg; do
|
||||||
|
cp -r ${f} InvokeAI-Installer/
|
||||||
|
done
|
||||||
|
|
||||||
cp -pr ../environments-and-requirements templates readme.txt InvokeAI-Installer/
|
# Move the wheel
|
||||||
mkdir InvokeAI-Installer/templates/rootdir
|
mv dist/*.whl InvokeAI-Installer/
|
||||||
|
|
||||||
cp -pr ../configs InvokeAI-Installer/templates/rootdir/
|
|
||||||
|
|
||||||
mkdir InvokeAI-Installer/templates/rootdir/{outputs,embeddings,models}
|
|
||||||
|
|
||||||
|
# Install scripts
|
||||||
|
# Mac/Linux
|
||||||
perl -p -e "s/^INVOKEAI_VERSION=.*/INVOKEAI_VERSION=\"$VERSION\"/" install.sh.in > InvokeAI-Installer/install.sh
|
perl -p -e "s/^INVOKEAI_VERSION=.*/INVOKEAI_VERSION=\"$VERSION\"/" install.sh.in > InvokeAI-Installer/install.sh
|
||||||
chmod a+rx InvokeAI-Installer/install.sh
|
chmod a+rx InvokeAI-Installer/install.sh
|
||||||
|
|
||||||
zip -r InvokeAI-installer-$VERSION-linux.zip InvokeAI-Installer
|
# Windows
|
||||||
zip -r InvokeAI-installer-$VERSION-mac.zip InvokeAI-Installer
|
|
||||||
|
|
||||||
# now do the windows installer
|
|
||||||
rm InvokeAI-Installer/install.sh
|
|
||||||
perl -p -e "s/^set INVOKEAI_VERSION=.*/set INVOKEAI_VERSION=$VERSION/" install.bat.in > InvokeAI-Installer/install.bat
|
perl -p -e "s/^set INVOKEAI_VERSION=.*/set INVOKEAI_VERSION=$VERSION/" install.bat.in > InvokeAI-Installer/install.bat
|
||||||
cp WinLongPathsEnabled.reg InvokeAI-Installer/
|
cp WinLongPathsEnabled.reg InvokeAI-Installer/
|
||||||
|
|
||||||
# this gets rid of the "-e ." at the end of the windows requirements file
|
# Zip everything up
|
||||||
# because it is easier to do it now than in the .bat install script
|
zip -r InvokeAI-installer-$VERSION.zip InvokeAI-Installer
|
||||||
egrep -v '^-e .' InvokeAI-Installer/environments-and-requirements/requirements-win-colab-cuda.txt > InvokeAI-Installer/requirements.txt
|
|
||||||
cp InvokeAI-Installer/requirements.txt InvokeAI-Installer/environments-and-requirements/requirements-win-colab-cuda.txt
|
|
||||||
zip -r InvokeAI-installer-$VERSION-windows.zip InvokeAI-Installer
|
|
||||||
|
|
||||||
|
# Updater
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
cp templates/update.sh.in tmp/update.sh
|
cp templates/update.sh.in tmp/update.sh
|
||||||
cp templates/update.bat.in tmp/update.bat
|
cp templates/update.bat.in tmp/update.bat
|
||||||
@ -66,9 +79,6 @@ cd ..
|
|||||||
mv tmp/InvokeAI-updater-$VERSION.zip .
|
mv tmp/InvokeAI-updater-$VERSION.zip .
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
rm -rf InvokeAI-Installer tmp
|
rm -rf InvokeAI-Installer tmp dist
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ if "%1" == "use-cache" (
|
|||||||
@rem The version in the next line is replaced by an up to date release number
|
@rem The version in the next line is replaced by an up to date release number
|
||||||
@rem when create_installer.sh is run. Change the release number there.
|
@rem when create_installer.sh is run. Change the release number there.
|
||||||
set INVOKEAI_VERSION=latest
|
set INVOKEAI_VERSION=latest
|
||||||
set INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/refs/tags/%INVOKEAI_VERSION%.zip
|
|
||||||
set INSTRUCTIONS=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/
|
set INSTRUCTIONS=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/
|
||||||
set TROUBLESHOOTING=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting
|
set TROUBLESHOOTING=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting
|
||||||
set PYTHON_URL=https://www.python.org/downloads/windows/
|
set PYTHON_URL=https://www.python.org/downloads/windows/
|
||||||
@ -70,7 +69,6 @@ del /q .tmp1 .tmp2
|
|||||||
call python main.py
|
call python main.py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@rem ------------------------ Subroutines ---------------
|
@rem ------------------------ Subroutines ---------------
|
||||||
@rem routine to do comparison of semantic version numbers
|
@rem routine to do comparison of semantic version numbers
|
||||||
@rem found at https://stackoverflow.com/questions/15807762/compare-version-numbers-in-batch-file
|
@rem found at https://stackoverflow.com/questions/15807762/compare-version-numbers-in-batch-file
|
||||||
|
@ -23,8 +23,8 @@ VERSION = "latest"
|
|||||||
# Install the virtualenv into the runtime dir
|
# Install the virtualenv into the runtime dir
|
||||||
FF_VENV_IN_RUNTIME = True
|
FF_VENV_IN_RUNTIME = True
|
||||||
|
|
||||||
# Install the wheel from pypi
|
# Install the wheel packaged with the installer
|
||||||
FF_USE_WHEEL = False
|
FF_USE_LOCAL_WHEEL = True
|
||||||
|
|
||||||
|
|
||||||
class Installer:
|
class Installer:
|
||||||
@ -240,6 +240,7 @@ class InvokeAiInstance:
|
|||||||
:type extra_index_url: str
|
:type extra_index_url: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
## this only applies to pypi installs; TODO actually use this
|
||||||
if self.version == "pre":
|
if self.version == "pre":
|
||||||
version = None
|
version = None
|
||||||
pre = "--pre"
|
pre = "--pre"
|
||||||
@ -247,11 +248,16 @@ class InvokeAiInstance:
|
|||||||
version = self.version
|
version = self.version
|
||||||
pre = None
|
pre = None
|
||||||
|
|
||||||
if FF_USE_WHEEL:
|
## TODO: only local wheel will be installed as of now; support for --version arg is TODO
|
||||||
src = f"invokeai=={version}" if version is not None else "invokeai"
|
if FF_USE_LOCAL_WHEEL:
|
||||||
else:
|
src = str(next(Path.cwd().glob("InvokeAI-*.whl")))
|
||||||
|
|
||||||
|
elif version == "source":
|
||||||
# this makes an assumption about the location of the installer package in the source tree
|
# this makes an assumption about the location of the installer package in the source tree
|
||||||
src = Path(__file__).parents[1].expanduser().resolve()
|
src = Path(__file__).parents[1].expanduser().resolve()
|
||||||
|
else:
|
||||||
|
# will install from PyPp
|
||||||
|
src = f"invokeai=={version}" if version is not None else "invokeai"
|
||||||
|
|
||||||
import messages
|
import messages
|
||||||
from plumbum import FG, local
|
from plumbum import FG, local
|
||||||
|
@ -43,8 +43,8 @@ Launching the installer:
|
|||||||
'./install.sh' (while keeping it inside the InvokeAI-Installer
|
'./install.sh' (while keeping it inside the InvokeAI-Installer
|
||||||
folder).
|
folder).
|
||||||
|
|
||||||
The installer will create a directory named "invokeai" in the folder
|
The installer will create a directory of your choice and install the
|
||||||
of your choice. This directory contains everything you need to run
|
InvokeAI application within it. This directory contains everything you need to run
|
||||||
invokeai. Once InvokeAI is up and running, you may delete the
|
invokeai. Once InvokeAI is up and running, you may delete the
|
||||||
InvokeAI-Installer folder at your convenience.
|
InvokeAI-Installer folder at your convenience.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user