mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Updated the installer to simplify the use of micromamba, and use conda for the actual installation; Update conda during the update script
This commit is contained in:
parent
8c2e82cc54
commit
b12c8a28d7
@ -18,34 +18,34 @@ The download link provides tar.bz2 files.
|
|||||||
# Create the installer
|
# Create the installer
|
||||||
Create the following folder structure, and zip it up.
|
Create the following folder structure, and zip it up.
|
||||||
|
|
||||||
For Linux/Mac: Make sure the `chmod u+x` permission is granted to `installer.sh` and the corresponding `micromamba` binary.
|
For Linux/Mac: Make sure the `chmod u+x` permission is granted to `install.sh` and the corresponding `micromamba` binary.
|
||||||
|
|
||||||
### Windows x64:
|
### Windows x64:
|
||||||
```
|
```
|
||||||
.\installer.bat
|
.\install.bat
|
||||||
.\installer_files\micromamba_win_x64.exe
|
.\installer_files\micromamba_win_x64.exe
|
||||||
```
|
```
|
||||||
|
|
||||||
### Linux x64:
|
### Linux x64:
|
||||||
```
|
```
|
||||||
.\installer.sh
|
.\install.sh
|
||||||
.\installer_files\micromamba_linux_x64
|
.\installer_files\micromamba_linux_x64
|
||||||
```
|
```
|
||||||
|
|
||||||
### Linux arm64:
|
### Linux arm64:
|
||||||
```
|
```
|
||||||
.\installer.sh
|
.\install.sh
|
||||||
.\installer_files\micromamba_linux_arm64
|
.\installer_files\micromamba_linux_arm64
|
||||||
```
|
```
|
||||||
|
|
||||||
### Mac x64:
|
### Mac x64:
|
||||||
```
|
```
|
||||||
.\installer.sh
|
.\install.sh
|
||||||
.\installer_files\micromamba_mac_x64
|
.\installer_files\micromamba_mac_x64
|
||||||
```
|
```
|
||||||
|
|
||||||
### Mac arm64 (M1/Apple Silicon):
|
### Mac arm64 (M1/Apple Silicon):
|
||||||
```
|
```
|
||||||
.\installer.sh
|
.\install.sh
|
||||||
.\installer_files\micromamba_mac_arm64
|
.\installer_files\micromamba_mac_arm64
|
||||||
```
|
```
|
@ -1,13 +1,13 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
@rem This script will install git and python (if not found on the PATH variable)
|
@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 using micromamba (an 8mb static-linked single-file binary, conda replacement).
|
||||||
@rem For users who already have git and python, this step will be skipped.
|
@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 Next, it'll checkout the project's git repo, if necessary.
|
||||||
@rem Finally, it'll create the conda environment and preload the models.
|
@rem Finally, it'll create the conda environment and preload the models.
|
||||||
|
|
||||||
@rem This enables a user to install this project without manually installing python and git.
|
@rem This enables a user to install this project without manually installing conda and git.
|
||||||
|
|
||||||
@rem prevent the window from closing after an error
|
@rem prevent the window from closing after an error
|
||||||
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
|
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
|
||||||
@ -16,51 +16,43 @@ if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
|
|||||||
set MAMBA_ROOT_PREFIX=%cd%\installer_files\mamba
|
set MAMBA_ROOT_PREFIX=%cd%\installer_files\mamba
|
||||||
set INSTALL_ENV_DIR=%cd%\installer_files\env
|
set INSTALL_ENV_DIR=%cd%\installer_files\env
|
||||||
set MICROMAMBA_BINARY_FILE=%cd%\installer_files\micromamba_win_x64.exe
|
set MICROMAMBA_BINARY_FILE=%cd%\installer_files\micromamba_win_x64.exe
|
||||||
set PATH=%PATH%;%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts
|
|
||||||
|
|
||||||
@rem figure out whether git and python needs to be installed
|
@rem figure out whether git and conda needs to be installed
|
||||||
set PACKAGES_TO_INSTALL=
|
set PACKAGES_TO_INSTALL=
|
||||||
|
|
||||||
call python --version "" >tmp/stdout.txt 2>tmp/stderr.txt
|
call conda --version "" >tmp/stdout.txt 2>tmp/stderr.txt
|
||||||
if "%ERRORLEVEL%" NEQ "0" set PACKAGES_TO_INSTALL=%PACKAGES_TO_INSTALL% python
|
if "%ERRORLEVEL%" NEQ "0" set PACKAGES_TO_INSTALL=%PACKAGES_TO_INSTALL% conda
|
||||||
|
|
||||||
call git --version "" >tmp/stdout.txt 2>tmp/stderr.txt
|
call git --version "" >tmp/stdout.txt 2>tmp/stderr.txt
|
||||||
if "%ERRORLEVEL%" NEQ "0" set PACKAGES_TO_INSTALL=%PACKAGES_TO_INSTALL% git
|
if "%ERRORLEVEL%" NEQ "0" set PACKAGES_TO_INSTALL=%PACKAGES_TO_INSTALL% git
|
||||||
|
|
||||||
@rem initialize micromamba
|
@rem (if necessary) install git and conda into a contained environment
|
||||||
if not exist "%MAMBA_ROOT_PREFIX%" (
|
if "%PACKAGES_TO_INSTALL%" NEQ "" (
|
||||||
|
@rem initialize micromamba
|
||||||
|
if not exist "%MAMBA_ROOT_PREFIX%" (
|
||||||
mkdir "%MAMBA_ROOT_PREFIX%"
|
mkdir "%MAMBA_ROOT_PREFIX%"
|
||||||
copy "%MICROMAMBA_BINARY_FILE%" "%MAMBA_ROOT_PREFIX%\micromamba.exe"
|
copy "%MICROMAMBA_BINARY_FILE%" "%MAMBA_ROOT_PREFIX%\micromamba.exe"
|
||||||
|
|
||||||
@rem test the mamba binary
|
@rem test the mamba binary
|
||||||
echo Micromamba version:
|
echo Micromamba version:
|
||||||
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version
|
||||||
|
|
||||||
@rem run the shell hook, otherwise activate will fail
|
|
||||||
if not exist "%MAMBA_ROOT_PREFIX%\Scripts" (
|
|
||||||
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" shell hook --log-level 4 -s cmd.exe
|
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
call "%MAMBA_ROOT_PREFIX%\condabin\mamba_hook.bat"
|
@rem create the installer env
|
||||||
|
|
||||||
@rem (if necessary) install git and python into a contained environment
|
|
||||||
if "%PACKAGES_TO_INSTALL%" NEQ "" (
|
|
||||||
echo "Packages to install: %PACKAGES_TO_INSTALL%"
|
|
||||||
|
|
||||||
@rem install git and python into the installer env
|
|
||||||
if not exist "%INSTALL_ENV_DIR%" (
|
if not exist "%INSTALL_ENV_DIR%" (
|
||||||
call micromamba create -y --prefix "%INSTALL_ENV_DIR%"
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" create -y --prefix "%INSTALL_ENV_DIR%"
|
||||||
)
|
)
|
||||||
|
|
||||||
call micromamba install -y --prefix "%INSTALL_ENV_DIR%" -c conda-forge %PACKAGES_TO_INSTALL%
|
echo "Packages to install:%PACKAGES_TO_INSTALL%"
|
||||||
|
|
||||||
@rem activate
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" install -y --prefix "%INSTALL_ENV_DIR%" -c conda-forge %PACKAGES_TO_INSTALL%
|
||||||
call micromamba activate "%INSTALL_ENV_DIR%"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set PATH=%PATH%;%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts
|
||||||
|
|
||||||
@rem get the repo (and load into the current directory)
|
@rem get the repo (and load into the current directory)
|
||||||
if not exist ".git" (
|
if not exist ".git" (
|
||||||
|
call git config --global init.defaultBranch main
|
||||||
call git init
|
call git init
|
||||||
call git remote add origin https://github.com/cmdr2/InvokeAI.git
|
call git remote add origin https://github.com/cmdr2/InvokeAI.git
|
||||||
call git fetch
|
call git fetch
|
||||||
@ -68,8 +60,8 @@ if not exist ".git" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
@rem create the environment
|
@rem create the environment
|
||||||
call micromamba create -y -f environment.yml
|
call conda env create
|
||||||
call micromamba activate invokeai
|
call conda activate invokeai
|
||||||
|
|
||||||
@rem preload the models
|
@rem preload the models
|
||||||
call python scripts\preload_models.py
|
call python scripts\preload_models.py
|
||||||
@ -77,4 +69,11 @@ call python scripts\preload_models.py
|
|||||||
@rem make the models dir
|
@rem make the models dir
|
||||||
mkdir models\ldm\stable-diffusion-v1
|
mkdir models\ldm\stable-diffusion-v1
|
||||||
|
|
||||||
|
@rem tell the user that they need to download the ckpt
|
||||||
|
echo.
|
||||||
|
echo "Now you need to install the weights for the stable diffusion model."
|
||||||
|
echo "Please follow the steps at https://invoke-ai.github.io/InvokeAI/installation/INSTALL_WINDOWS/ to complete the installation"
|
||||||
|
|
||||||
|
@rem it would be nice if the weights downloaded automatically, and didn't need the user to do this manually.
|
||||||
|
|
||||||
pause
|
pause
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# This script will install git and python (if not found on the PATH variable)
|
# 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).
|
# using micromamba (an 8mb static-linked single-file binary, conda replacement).
|
||||||
# For users who already have git and python, this step will be skipped.
|
# For users who already have git and conda, this step will be skipped.
|
||||||
|
|
||||||
# Next, it'll checkout the project's git repo, if necessary.
|
# Next, it'll checkout the project's git repo, if necessary.
|
||||||
# Finally, it'll create the conda environment and preload the models.
|
# Finally, it'll create the conda environment and preload the models.
|
||||||
|
|
||||||
# This enables a user to install this project without manually installing python and git.
|
# This enables a user to install this project without manually installing conda and git.
|
||||||
|
|
||||||
OS_NAME=$(uname -s)
|
OS_NAME=$(uname -s)
|
||||||
case "${OS_NAME}" in
|
case "${OS_NAME}" in
|
||||||
@ -27,42 +27,40 @@ esac
|
|||||||
export MAMBA_ROOT_PREFIX="$(pwd)/installer_files/mamba"
|
export MAMBA_ROOT_PREFIX="$(pwd)/installer_files/mamba"
|
||||||
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
|
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
|
||||||
MICROMAMBA_BINARY_FILE="$(pwd)/installer_files/micromamba_${OS_NAME}_${OS_ARCH}"
|
MICROMAMBA_BINARY_FILE="$(pwd)/installer_files/micromamba_${OS_NAME}_${OS_ARCH}"
|
||||||
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$PATH;$INSTALL_ENV_DIR/bin"; fi
|
|
||||||
|
|
||||||
# figure out what needs to be installed
|
# figure out whether git and conda needs to be installed
|
||||||
PACKAGES_TO_INSTALL=""
|
PACKAGES_TO_INSTALL=""
|
||||||
|
|
||||||
if ! hash "python" &>/dev/null; then PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL python"; fi
|
if ! hash "conda" &>/dev/null; then PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL conda"; fi
|
||||||
if ! hash "git" &>/dev/null; then PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL git"; fi
|
if ! hash "git" &>/dev/null; then PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL git"; fi
|
||||||
|
|
||||||
# initialize micromamba
|
# (if necessary) install git and conda into a contained environment
|
||||||
mkdir -p "$MAMBA_ROOT_PREFIX"
|
|
||||||
cp "$MICROMAMBA_BINARY_FILE" "$MAMBA_ROOT_PREFIX/micromamba"
|
|
||||||
|
|
||||||
# test the mamba binary
|
|
||||||
echo Micromamba version:
|
|
||||||
"$MAMBA_ROOT_PREFIX/micromamba" --version
|
|
||||||
|
|
||||||
# run the shell hook, otherwise activate will fail
|
|
||||||
eval "$($MAMBA_ROOT_PREFIX/micromamba shell hook -s posix)"
|
|
||||||
|
|
||||||
# install git and python into a contained environment (if necessary)
|
|
||||||
if [ "$PACKAGES_TO_INSTALL" != "" ]; then
|
if [ "$PACKAGES_TO_INSTALL" != "" ]; then
|
||||||
echo "Packages to install: $PACKAGES_TO_INSTALL"
|
# initialize micromamba
|
||||||
|
if [ ! -e "$MAMBA_ROOT_PREFIX" ]; then
|
||||||
|
mkdir -p "$MAMBA_ROOT_PREFIX"
|
||||||
|
cp "$MICROMAMBA_BINARY_FILE" "$MAMBA_ROOT_PREFIX/micromamba"
|
||||||
|
|
||||||
# install git and python into the installer env
|
# test the mamba binary
|
||||||
if [ ! -e "$INSTALL_ENV_DIR" ]; then
|
echo "Micromamba version:"
|
||||||
micromamba create -y --prefix "$INSTALL_ENV_DIR"
|
"$MAMBA_ROOT_PREFIX/micromamba" --version
|
||||||
fi
|
fi
|
||||||
|
|
||||||
micromamba install -y --prefix "$INSTALL_ENV_DIR" -c conda-forge $PACKAGES_TO_INSTALL
|
# create the installer env
|
||||||
|
if [ ! -e "$INSTALL_ENV_DIR" ]; then
|
||||||
|
"$MAMBA_ROOT_PREFIX/micromamba" create -y --prefix "$INSTALL_ENV_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
# activate
|
echo "Packages to install:$PACKAGES_TO_INSTALL"
|
||||||
micromamba activate "$INSTALL_ENV_DIR"
|
|
||||||
|
"$MAMBA_ROOT_PREFIX/micromamba" install -y --prefix "$INSTALL_ENV_DIR" -c conda-forge $PACKAGES_TO_INSTALL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$PATH;$INSTALL_ENV_DIR/bin"; fi
|
||||||
|
|
||||||
# get the repo (and load into the current directory)
|
# get the repo (and load into the current directory)
|
||||||
if [ ! -e ".git" ]; then
|
if [ ! -e ".git"]; then
|
||||||
|
git config --global init.defaultBranch main
|
||||||
git init
|
git init
|
||||||
git remote add origin https://github.com/cmdr2/InvokeAI.git
|
git remote add origin https://github.com/cmdr2/InvokeAI.git
|
||||||
git fetch
|
git fetch
|
||||||
@ -71,15 +69,27 @@ fi
|
|||||||
|
|
||||||
# create the environment
|
# create the environment
|
||||||
if [ "$OS_NAME" == "mac" ]; then
|
if [ "$OS_NAME" == "mac" ]; then
|
||||||
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-arm64 micromamba create -y -f environment-mac.yml
|
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-arm64 conda env create -y -f environment-mac.yml
|
||||||
else
|
else
|
||||||
micromamba create -y -f environment.yml
|
conda env create -y -f environment.yml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
micromamba activate invokeai
|
conda activate invokeai
|
||||||
|
|
||||||
# preload the models
|
# preload the models
|
||||||
python scripts/preload_models.py
|
python scripts/preload_models.py
|
||||||
|
|
||||||
# make the models dir
|
# make the models dir
|
||||||
mkdir -p models/ldm/stable-diffusion-v1
|
mkdir models/ldm/stable-diffusion-v1
|
||||||
|
|
||||||
|
# tell the user that they need to download the ckpt
|
||||||
|
WEIGHTS_DOC_URL="https://invoke-ai.github.io/InvokeAI/installation/INSTALL_LINUX/"
|
||||||
|
if [ "$OS_NAME" == "mac" ]; then
|
||||||
|
WEIGHTS_DOC_URL="https://invoke-ai.github.io/InvokeAI/installation/INSTALL_MAC/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo "Now you need to install the weights for the stable diffusion model."
|
||||||
|
echo "Please follow the steps at $WEIGHTS_DOC_URL to complete the installation"
|
||||||
|
|
||||||
|
# it would be nice if the weights downloaded automatically, and didn't need the user to do this manually.
|
||||||
|
26
invoke.bat
26
invoke.bat
@ -3,27 +3,9 @@
|
|||||||
@rem prevent the window from closing after running the commands
|
@rem prevent the window from closing after running the commands
|
||||||
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
|
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
|
||||||
|
|
||||||
@rem check if conda exists, otherwise use micromamba
|
set INSTALL_ENV_DIR=%cd%\installer_files\env
|
||||||
set CONDA_COMMAND=conda
|
set PATH=%PATH%;%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts
|
||||||
|
|
||||||
call conda --version "" >tmp/stdout.txt 2>tmp/stderr.txt
|
call conda activate invokeai
|
||||||
if "%ERRORLEVEL%" NEQ "0" set CONDA_COMMAND=micromamba
|
|
||||||
|
|
||||||
@rem initialize micromamba, if using that
|
echo Ready to dream..
|
||||||
if "%CONDA_COMMAND%" EQU "micromamba" (
|
|
||||||
set MAMBA_ROOT_PREFIX=%cd%\installer_files\mamba
|
|
||||||
set INSTALL_ENV_DIR=%cd%\installer_files\env
|
|
||||||
|
|
||||||
if not exist "%MAMBA_ROOT_PREFIX%\condabin" (
|
|
||||||
echo "Have you run install.bat?"
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
call "%MAMBA_ROOT_PREFIX%\condabin\mamba_hook.bat"
|
|
||||||
|
|
||||||
call micromamba activate "%INSTALL_ENV_DIR%"
|
|
||||||
)
|
|
||||||
|
|
||||||
call %CONDA_COMMAND% activate invokeai
|
|
||||||
|
|
||||||
pause
|
|
||||||
|
21
invoke.sh
21
invoke.sh
@ -1,27 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$0" == "bash" ]; then
|
if [ "$0" == "bash" ]; then
|
||||||
# check if conda exists, otherwise use micromamba
|
|
||||||
CONDA_COMMAND="conda"
|
|
||||||
|
|
||||||
if ! hash "conda" &>/dev/null; then CONDA_COMMAND="micromamba"; fi
|
|
||||||
|
|
||||||
# initialize micromamba, if using that
|
|
||||||
if [ "$CONDA_COMMAND" == "micromamba" ]; then
|
|
||||||
export MAMBA_ROOT_PREFIX="$(pwd)/installer_files/mamba"
|
|
||||||
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
|
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
|
||||||
|
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$PATH;$INSTALL_ENV_DIR/bin"; fi
|
||||||
|
|
||||||
if [ ! -e "$MAMBA_ROOT_PREFIX" ]; then
|
conda activate invokeai
|
||||||
echo "Have you run install.sh?"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
eval "$($MAMBA_ROOT_PREFIX/micromamba shell hook -s posix)"
|
echo "Ready to dream.."
|
||||||
|
|
||||||
micromamba activate "$INSTALL_ENV_DIR"
|
|
||||||
)
|
|
||||||
|
|
||||||
$CONDA_COMMAND activate invokeai
|
|
||||||
else
|
else
|
||||||
bash --init-file invoke.sh
|
bash --init-file invoke.sh
|
||||||
fi
|
fi
|
||||||
|
@ -8,4 +8,6 @@ if exist ".git" (
|
|||||||
call git pull
|
call git pull
|
||||||
)
|
)
|
||||||
|
|
||||||
|
conda env update
|
||||||
|
|
||||||
pause
|
pause
|
@ -1,10 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
|
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
|
||||||
|
|
||||||
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$PATH;$INSTALL_ENV_DIR/bin"; fi
|
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$PATH;$INSTALL_ENV_DIR/bin"; fi
|
||||||
|
|
||||||
# update the repo
|
# update the repo
|
||||||
if [ -e ".git" ]; then
|
if [ -e ".git" ]; then
|
||||||
git pull
|
git pull
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user