diff --git a/installer/create_installer.sh b/installer/create_installer.sh index 83eff14c4c..4be13e3fed 100755 --- a/installer/create_installer.sh +++ b/installer/create_installer.sh @@ -3,6 +3,7 @@ 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..." diff --git a/installer/install.bat.in b/installer/install.bat.in index 51e47bb645..e34d059251 100644 --- a/installer/install.bat.in +++ b/installer/install.bat.in @@ -22,7 +22,6 @@ 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 ------------------------------- @@ -65,23 +64,21 @@ if %errorlevel% == 1 ( @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="" +set "rootdir=" +set "response=" +set "selection=" :pick_rootdir - if %rootdir% neq "" goto :done + if defined rootdir 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 not defined selection set selection=%UserProfile% + set selection=%selection:"=% + 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]: @@ -93,16 +90,18 @@ set selection="" 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="" + if /I !response! neq y set "rootdir=" goto :pick_rootdir :done +set rootdir=%rootdir:"=% + @rem ---------------------- Initialize the runtime directory --------------------- echo. echo *** Creating Runtime Directory %rootdir% *** -if not exist %rootdir% mkdir %rootdir% +if not exist "%rootdir%" mkdir "%rootdir%" @rem for unknown reasons the mkdir works but returns an error code -if not exist %rootdir% ( +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 ) @@ -111,7 +110,7 @@ echo Successful. @rem --------------------------- Create and populate .venv --------------------------- echo. echo ** Creating Virtual Environment for InvokeAI ** -call python -mvenv %rootdir%\.venv +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 @@ -120,18 +119,24 @@ echo Successful. echo. echo *** Installing InvokeAI Requirements *** -call %rootdir%\.venv\Scripts\activate.bat +echo Activating environment +call "%rootdir%\.venv\Scripts\activate.bat" + +set PYTHON=%rootdir%\.venv\Scripts\python +echo updating pip with "%PYTHON%" +call "%PYTHON%" -mensurepip --upgrade + copy environments-and-requirements\requirements-win-colab-cuda.txt .\requirements.txt -call python -mpip install -r requirements.txt +call "%PYTHON%" -mpip install --prefer-binary -r requirements.txt if %errorlevel% neq 0 ( - set err_msg=Installation of requirements failed. See above for errors and check %TROUBLESHOOTING% for potential solutions. + set err_msg=Requirements installation 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% +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 @@ -139,21 +144,21 @@ if %errorlevel% neq 0 ( echo Installation successful. @rem --------------------------- Set up the root directory --------------------------- -xcopy /E /Y .\templates\rootdir %rootdir% +xcopy /E /Y .\templates\rootdir "%rootdir%" PUSHD "%rootdir%" -call .venv\Scripts\python .venv\Scripts\configure_invokeai.py --root="%rootdir%" +call "%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 +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 +mkdir "%rootdir%\environments-and-requirements" +xcopy /I /Y .\environments-and-requirements "%rootdir%\environments-and-requirements" +copy .\requirements.txt "%rootdir%\requirements.txt" echo. @@ -213,3 +218,4 @@ echo The installer will exit now. pause exit /b +pause diff --git a/installer/install.sh.in b/installer/install.sh.in index 0fd3de30a3..c128d2b35b 100644 --- a/installer/install.sh.in +++ b/installer/install.sh.in @@ -126,17 +126,17 @@ do read -e -p "InvokeAI will be installed into $ROOTDIR. OK? [y]: " input RESPONSE=${input:='y'} if [ "$RESPONSE" == 'y' ]; then - if [ -e $ROOTDIR ]; then + if [ -e "$ROOTDIR" ]; then echo - read -e -p "Directory $ROOTDIR already exists. Do you want to resume an interrupted install? [y]: " input + 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 + mkdir -p "$ROOTDIR" if [ $? -ne 0 ]; then - echo "Could not create $ROOTDIR. Try again with a different install location." + echo "Could not create "$ROOTDIR". Try again with a different install location." ROOTDIR="" fi fi @@ -149,18 +149,19 @@ 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." +$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." +source "$ROOTDIR"/.venv/bin/activate +_err_exit $? "Failed to activate virtual evironment "$ROOTDIR"/.venv. Please see $TROUBLESHOOTING for help." -PYTHON=$ROOTDIR/.venv/bin/python +PYTHON="$ROOTDIR"/.venv/bin/python +$PYTHON -mensurepip --upgrade +$PYTHON -mpip install --upgrade pip #-------------------------------------------------------------------------------- echo @@ -179,7 +180,7 @@ else fi fi -$PYTHON -mpip install -r requirements.txt +$PYTHON -mpip install --prefer-binary -r requirements.txt _err_exit $? "Failed to install InvokeAI's dependencies." #-------------------------------------------------------------------------------- @@ -189,29 +190,29 @@ $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 +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/ +cp -pr environments-and-requirements requirements.txt "$ROOTDIR/" #-------------------------------------------------------------------------------- echo echo "*** Confguring InvokeAI ***" -pushd $ROOTDIR -./.venv/bin/configure_invokeai.py --root=$ROOTDIR +pushd "$ROOTDIR" >/dev/null +$PYTHON ./.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/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 +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"