mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(install): more fixes
- install scripts: - allow EN-abling pip cache (use 'use-cache' as an arg to the install script) - debug message showing which sourceball we're downloading - add 'wheel' to pip update, so we can speed up installs from source (and quiet deprecations) - install.sh: use absolute path for micromamba - setup.py: - fill 'install_requires' using 'requirements.in' - fix 'load_models' script name Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
This commit is contained in:
parent
0d35a67e9c
commit
0340d9ad53
@ -10,6 +10,11 @@
|
||||
|
||||
@rem This enables a user to install this project without manually installing git or Python
|
||||
|
||||
set "no_cache_dir=--no-cache-dir"
|
||||
if "%1" == "use-cache" (
|
||||
set "no_cache_dir="
|
||||
)
|
||||
|
||||
echo ***** Installing InvokeAI.. *****
|
||||
|
||||
@rem Config
|
||||
@ -63,7 +68,8 @@ set PATH=%INSTALL_ENV_DIR%\Library\bin;%PATH%
|
||||
|
||||
@rem Download/unpack/clean up InvokeAI release sourceball
|
||||
set err_msg=----- InvokeAI source download failed -----
|
||||
curl -L %RELEASE_URL%/%RELEASE_SOURCEBALL% --output InvokeAI.tgz
|
||||
echo Trying to download "%RELEASE_URL%%RELEASE_SOURCEBALL%"
|
||||
curl -L %RELEASE_URL%%RELEASE_SOURCEBALL% --output InvokeAI.tgz
|
||||
if %errorlevel% neq 0 goto err_exit
|
||||
|
||||
set err_msg=----- InvokeAI source unpack failed -----
|
||||
@ -113,7 +119,7 @@ echo We're running under
|
||||
if %errorlevel% neq 0 goto err_exit
|
||||
|
||||
set err_msg=----- pip update failed -----
|
||||
.venv\Scripts\python -m pip install --no-cache-dir --no-warn-script-location --upgrade pip
|
||||
.venv\Scripts\python -m pip install %no_cache_dir% --no-warn-script-location --upgrade pip wheel
|
||||
if %errorlevel% neq 0 goto err_exit
|
||||
|
||||
echo ***** Updated pip *****
|
||||
@ -123,11 +129,11 @@ copy installer\py3.10-windows-x86_64-cuda-reqs.txt requirements.txt
|
||||
if %errorlevel% neq 0 goto err_exit
|
||||
|
||||
set err_msg=----- main pip install failed -----
|
||||
.venv\Scripts\python -m pip install --no-cache-dir --no-warn-script-location -r requirements.txt
|
||||
.venv\Scripts\python -m pip install %no_cache_dir% --no-warn-script-location -r requirements.txt
|
||||
if %errorlevel% neq 0 goto err_exit
|
||||
|
||||
set err_msg=----- InvokeAI setup failed -----
|
||||
.venv\Scripts\python -m pip install --no-cache-dir --no-warn-script-location -e .
|
||||
.venv\Scripts\python -m pip install %no_cache_dir% --no-warn-script-location -e .
|
||||
if %errorlevel% neq 0 goto err_exit
|
||||
|
||||
echo ***** Installed Python dependencies *****
|
||||
|
@ -22,6 +22,15 @@ function _err_exit {
|
||||
|
||||
# This enables a user to install this project without manually installing git or Python
|
||||
|
||||
export no_cache_dir="--no-cache-dir"
|
||||
if [ $# -ge 1 ]; then
|
||||
if [ "$1" = "use-cache" ]; then
|
||||
export no_cache_dir=""
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$no_cache_dir"
|
||||
|
||||
echo -e "\n***** Installing InvokeAI... *****\n"
|
||||
|
||||
|
||||
@ -93,20 +102,20 @@ if [ "$PACKAGES_TO_INSTALL" != "" ]; then
|
||||
|
||||
curl -L "$MICROMAMBA_DOWNLOAD_URL" | tar -xvjO bin/micromamba > micromamba
|
||||
|
||||
chmod u+x "micromamba"
|
||||
chmod u+x ./micromamba
|
||||
|
||||
# test the mamba binary
|
||||
echo -e "\n***** Micromamba version: *****\n"
|
||||
"micromamba" --version
|
||||
./micromamba --version
|
||||
|
||||
# create the installer env
|
||||
if [ ! -e "$INSTALL_ENV_DIR" ]; then
|
||||
"micromamba" create -y --prefix "$INSTALL_ENV_DIR"
|
||||
./micromamba create -y --prefix "$INSTALL_ENV_DIR"
|
||||
fi
|
||||
|
||||
echo -e "\n***** Packages to install:$PACKAGES_TO_INSTALL *****\n"
|
||||
|
||||
"micromamba" install -y --prefix "$INSTALL_ENV_DIR" -c conda-forge $PACKAGES_TO_INSTALL
|
||||
./micromamba install -y --prefix "$INSTALL_ENV_DIR" -c conda-forge "$PACKAGES_TO_INSTALL"
|
||||
|
||||
if [ ! -e "$INSTALL_ENV_DIR" ]; then
|
||||
echo -e "\n----- There was a problem while initializing micromamba. Cannot continue. -----\n"
|
||||
@ -164,7 +173,7 @@ if [ "$OS_NAME" == "darwin" ]; then
|
||||
chmod +w "${SYSCONFIG}"
|
||||
cp "${SYSCONFIG}" "${TMPFILE}"
|
||||
sed "s,'/install,'${PYTHON_INSTALL_DIR},g" "${TMPFILE}" > "${SYSCONFIG}"
|
||||
rm -f ${TMPFILE}
|
||||
rm -f "${TMPFILE}"
|
||||
fi
|
||||
|
||||
./python/bin/python3 -E -s -m venv .venv
|
||||
@ -180,7 +189,7 @@ echo -e "We're running under"
|
||||
_err_exit $? _err_msg
|
||||
|
||||
_err_msg="\n----- pip update failed -----\n"
|
||||
.venv/bin/python3 -m pip install --no-cache-dir --no-warn-script-location --upgrade pip
|
||||
.venv/bin/python3 -m pip install "$no_cache_dir" --no-warn-script-location --upgrade pip wheel
|
||||
_err_exit $? _err_msg
|
||||
|
||||
echo -e "\n***** Updated pip *****\n"
|
||||
@ -190,11 +199,11 @@ cp installer/py3.10-${OS_NAME}-"${OS_ARCH}"-${CD}-reqs.txt requirements.txt
|
||||
_err_exit $? _err_msg
|
||||
|
||||
_err_msg="\n----- main pip install failed -----\n"
|
||||
.venv/bin/python3 -m pip install --no-cache-dir --no-warn-script-location -r requirements.txt
|
||||
.venv/bin/python3 -m pip install "$no_cache_dir" --no-warn-script-location -r requirements.txt
|
||||
_err_exit $? _err_msg
|
||||
|
||||
_err_msg="\n----- InvokeAI setup failed -----\n"
|
||||
.venv/bin/python3 -m pip install --no-cache-dir --no-warn-script-location -e .
|
||||
.venv/bin/python3 -m pip install "$no_cache_dir" --no-warn-script-location -e .
|
||||
_err_exit $? _err_msg
|
||||
|
||||
echo -e "\n***** Installed Python dependencies *****\n"
|
||||
|
40
setup.py
40
setup.py
@ -1,5 +1,7 @@
|
||||
from setuptools import setup, find_packages
|
||||
import os
|
||||
import re
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
def frontend_files(directory):
|
||||
paths = []
|
||||
@ -8,6 +10,20 @@ def frontend_files(directory):
|
||||
paths.append(os.path.join(path, filename))
|
||||
return paths
|
||||
|
||||
|
||||
def _get_requirements(path):
|
||||
try:
|
||||
with open(path) as f:
|
||||
packages = f.read().splitlines()
|
||||
except (IOError, OSError) as ex:
|
||||
raise RuntimeError("Can't open file with requirements: %s", repr(ex))
|
||||
|
||||
# Drop option lines
|
||||
packages = [package for package in packages if not re.match(r"^--", package)]
|
||||
packages = [package for package in packages if not re.match(r"^http", package)]
|
||||
return packages
|
||||
|
||||
|
||||
frontend_files = frontend_files('frontend/dist')
|
||||
print(f'DEBUG: {frontend_files}')
|
||||
|
||||
@ -30,25 +46,7 @@ setup(
|
||||
url=HOMEPAGE,
|
||||
license='MIT',
|
||||
packages=find_packages(exclude=['tests.*']),
|
||||
install_requires=[
|
||||
'accelerate',
|
||||
'albumentations',
|
||||
'diffusers',
|
||||
'eventlet',
|
||||
'flask_cors',
|
||||
'flask_socketio',
|
||||
'flaskwebgui',
|
||||
'getpass_asterisk',
|
||||
'imageio-ffmpeg',
|
||||
'pyreadline3',
|
||||
'realesrgan',
|
||||
'send2trash',
|
||||
'streamlit',
|
||||
'taming-transformers-rom1504',
|
||||
'test-tube',
|
||||
'torch-fidelity',
|
||||
'transformers'
|
||||
],
|
||||
install_requires=_get_requirements('installer/requirements.in'),
|
||||
python_requires='>=3.8, <4',
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
@ -72,7 +70,7 @@ setup(
|
||||
'Topic :: Scientific/Engineering :: Artificial Intelligence',
|
||||
'Topic :: Scientific/Engineering :: Image Processing',
|
||||
],
|
||||
scripts = ['scripts/invoke.py','scripts/load_models.py','scripts/sd-metadata.py'],
|
||||
scripts = ['scripts/invoke.py','scripts/configure_invokeai.py','scripts/sd-metadata.py'],
|
||||
data_files=[('frontend',frontend_files)],
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user