Skip to content

Conversation

@cmdr2
Copy link
Contributor

@cmdr2 cmdr2 commented Oct 26, 2022

Hi,

This PR enables a user to install this project without requiring them to have anaconda or git pre-installed. This reduces unnecessary friction for users who aren't programmers or very technical. If a user already has anaconda or git pre-installed, these scripts will just pass-through and won't affect them. Honestly, it's just more straightforward for a user to use. :)

Current installation process for a user:

  1. Install Anaconda
  2. Install Git
  3. Run the commands for a git pull (on Windows)
  4. Run the webui script

Suggested new process (for Windows, Linux and optionally Mac):

  1. Download and unzip the installer for their OS (linked below, or better, from a release on your project)
  2. Run the script

That's it.

Main improvement: The user doesn't need to have python/anaconda/git pre-installed. This reduces unnecessary friction for non-technical users.

1-click Installers:


I've tested this on Windows x64 and Linux x64. I've tested this with and without Anaconda pre-installed. I've also tested it works if the installer gets interrupted mid-way, and needs to be re-run.

Disclosure: I'm the author of the cmdr2 UI and 1-click installer (https://github.com/cmdr2/stable-diffusion-ui). We use a similar approach and it's been working quite well (~1k installs/day) for over 2 months. None of the support issues have been due to this bootstrapping process, but rather due to the usual pip failures, VPN issues, bad system config etc.

How it works:

  1. This script will install git and conda (if not found on the system PATH) using micromamba (an 8mb static-linked single-file binary, conda replacement). The micromamba binary will be downloaded if necessary using curl.

For users who already have git and python, this step will be skipped.

  1. Next, it'll checkout the project's git repo, if necessary.

  2. Next, it'll run the usual conda create commands (from the docs) to download the dependencies.

  3. Finally, it'll then run the preload_models.py script to download the weights (except the SD 1.4 model).

After installation, users can run the new invoke.bat or invoke.sh scripts to enter a pre-activated conda environment. They can also do it the old way (of manually activating conda). It'll use either the git/python/conda that was installed through this installer, or the user's existing git/python/conda installation.

The user will be presented with an option to start the command-line, or the web UI.

Finally, the user can run the new update.bat or update.sh script to update the git repo and the conda environment.

Next steps (if you wish to adopt this)

If you're willing, then the next steps are:

  1. Merging this PR will get the installer scripts into the installer folder
  2. Uploading the installer files to a GitHub release, or using the uploaded links inside this PR
  3. Updating the README with the download links for the installer.

If you're interested in this, I'd definitely suggest phasing this in gradually, maybe suggested as an easier alternative on the docs, until it is judged stable to use.

Thanks! :)

cmdr2 and others added 30 commits October 12, 2022 16:38
…ontained environment (if necessary) before running the normal installation script
…a for the actual installation; Update conda during the update script
…atically on the first run; Activate the base environment before running the rest of the conda commands; Don't download conda/git again if it's already been installed by the installer
…ontained environment (if necessary) before running the normal installation script
@tildebyte
Copy link
Contributor

We really need to stress to users that they should put the install script in a new folder/dir before they launch it - currently it dumps everything in the script's pwd, which makes a serious mess if one runs it in e.g. $HOME

@hipsterusername
Copy link
Member

We really need to stress to users that they should put the install script in a new folder/dir before they launch it - currently it dumps everything in the script's pwd, which makes a serious mess if one runs it in e.g. $HOME

Yes - And potentially add a confirm step to the install process to verify they've done it

@Any-Winter-4079
Copy link
Contributor

Any-Winter-4079 commented Oct 26, 2022

if [ "$OS_NAME" == "mac" ]; then
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-${OS_ARCH} conda env create -f environment-mac.yml

@Vargol tagging you b/c you were running different requirements (requirements-mac-MPS-CPU) vs. environment-mac.yml.
If so, a single Mac install may not cut it (I mean, it can, but it needs to detect system info, e.g. RAM, to determine which to install).

Which by the way, what is the cut-off point / what determines who installs with requirements-mac-MPS-CPU vs. environment-mac.yml?

@Vargol
Copy link
Contributor

Vargol commented Oct 26, 2022

No cut off point, just a series of poor experiences with conda, I don't want that thing any where my mac.
As far as I'm concerned it adds nothing of value, and many of the things people say are pro's are con's to me.

@tildebyte
Copy link
Contributor

As soon as this is fully tested and merged, I intend to replace conda with pip and venv. mambathingy can stay as an easy way to install git.

Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really like to get this into 2.1. It's a big improvement and just needs documentation.

Please add a pointer to the installer scripts in the README file under the main Installation section, and add a walkthrough in docs/installation/ONE-CLICK-INSTALL.md (or whatever you'd like to name the file). I hope to get the PR for automatic model loading merged in today, so that will be taken care of.

Finally, as others have noted, there needs to be a message printed at the end that tells users what to do to get the CLI and/or WebGUIs running. (Apologies if you've already done this)

@lstein lstein marked this pull request as ready for review October 27, 2022 21:15
@netsvetaev
Copy link
Contributor

Seems it works

Installing InvokeAI..
CondaValueError: prefix already exists: /Users/artur/miniconda3/envs/invokeai
NOTE: Redirects are currently not supported in Windows or MacOs.
Installing bert tokenizer (ignore deprecation errors)......success
Installing Kornia requirements......success
Loading CLIP model......success
/Users/artur/miniconda3/envs/invokeai/lib/python3.9/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and will be removed in 0.15, please use 'weights' instead.
  warnings.warn(
/Users/artur/miniconda3/envs/invokeai/lib/python3.9/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=None`.
  warnings.warn(msg)
Installing models from RealESRGAN and facexlib......success
Loading models from GFPGAN
Installing CodeFormer model file......success
Installing clipseg model for text-based masking......success
Installing safety model for NSFW content detection......success
mkdir: models/ldm/stable-diffusion-v1: File exists

But as a user, I’ve been stuck with this

Now you need to install the weights for the stable diffusion model.
Please follow the steps at https://invoke-ai.github.io/InvokeAI/installation/INSTALL_MAC/ to complete the installation

Are we going to do a fully automatic installation or to leave it like that?

@cmdr2
Copy link
Contributor Author

cmdr2 commented Oct 28, 2022

Thanks everyone, I plan on working on the PR comments later today.

@netsvetaev
Copy link
Contributor

netsvetaev commented Oct 29, 2022

M1, macos Ventura 13.1. Webserver error

>> Point your browser at http://127.0.0.1:9090
127.0.0.1 - - [29/Oct/2022 03:37:23] code 400, message Bad request version ('&\x89\x00*ÊÊ\x13\x01\x13\x02\x13\x03À,À+Ì©À0À/̨À')
ò�£òí{â?wûbk(ß,ks Oct/2022 03:37:23] "üPköpcy�vr�Ê
                  ѹrÎ�ßÎ{H�ý;­Î\Ò�Q�«ñ~�u�&�*ÊÊÀ,À+Ì©À0À/̨À" 400 -
127.0.0.1 - - [29/Oct/2022 03:37:23] code 400, message Bad request version ('\x83\x00,jj\x13\x01\x13\x02\x13\x03À,À+Ì©À0À/̨À')
127.0.0.1 - - [29/Oct/2022 03:37:23] "ü�r�Ø�2hÖNÄÏ#��óD\Z²Æ·}S´&W�AjJ <?	ôjÔü�¬+zÈÁE±®¡%f(=pj®5�,jjÀ,À+Ì©À0À/̨À" 400 -
127.0.0.1 - - [29/Oct/2022 03:37:23] code 400, message Bad request version ('Òª\x00\x00\x14À')
�ÒªÀ 400 -- - [29/Oct/2022 03:37:23] "��ÈL©Ô�ÞÊ�bchZ)��ÈÑùmy7ûÂ
127.0.0.1 - - [29/Oct/2022 03:37:23] code 400, message Bad request version ('\x00*ÚÚ\x13\x01\x13\x02\x13\x03À,À+Ì©À0À/̨À')
127.0.0.1 - - [29/Oct/2022 03:37:23] "üß�Ôð«76?wÂýÞ��:§)K½�ê´�B-Ѷ�S
                                                                    õ �GÏ�¡��öeqítý_I0/"/B�ï­YAÄS"¼o*ÚÚÀ,À+Ì©À0À/̨À" 400 -
127.0.0.1 - - [29/Oct/2022 03:37:23] code 400, message Bad request version ('(\x05¬R\x00,\x1a\x1a\x13\x01\x13\x02\x13\x03À,À+Ì©À0À/̨À')
127.0.0.1 - - [29/Oct/2022 03:37:23] "ü�¿Æ�f;á�°Í¼�ÔÍ}æÔ�éñηÙ
                                                              ¦FXyÖ ��Í�ÏY4�ó��éC˸æ¤d�©æ=µoNg	(¬R,À,À+Ì©À0À/̨À" 400 -
127.0.0.1 - - [29/Oct/2022 03:37:23] code 400, message Bad request version ('\x90\x00\x00\x14À')
127.0.0.1 - - [29/Oct/2022 03:37:23] "��Ò1è`�	G�R^�þ±�ÌÙ²ó�ú­Ò�ï¦l$�À" 400 -

Also, it installs right in the /user/ folder. Better to create a separate one for SD.

@lstein
Copy link
Collaborator

lstein commented Oct 29, 2022

I've just rewritten the preload_models.py script to interactively download, install and configure the user's preferred weights files. It is in PR #1290 . Once this is accepted, the installer script here will be able to do a full end-to-end install with minimal user intervention.

At that point, there's just a little documentation and videography, plus the debugging. I'll make a release branch when the preload script is tested and merged.

@cmdr2
Copy link
Contributor Author

cmdr2 commented Oct 29, 2022

Thanks, I've made the changes based on the PR comments, and I think this PR is ready (from my end) to be considered for merging.

After merging, 4 things need to happen:

  1. The git repo path in install.sh/bat needs to change to the main invokeAI repo
  2. The micromamba.exe download path in install.bat needs to change to a release URL from the invokeAI repo
  3. The installer zips need to be hosted on the invokeAI repo
  4. The documentation needs to be changed (I'd suggest in a phased manner).

PR feedback and changes:

  1. Squashing commits - I squashed the commits in my development branch, but I can't change this PR's source branch. If you can do that, then you'll get a squashed commit. Squashing in my main branch is tricky because the commit history is merged with other unrelated commits by other folks.

Otherwise, you can always just press the "Squash and Merge" in this PR, using the arrow next to the "Merge" button: https://stackoverflow.com/a/36377439

  1. Showing the next steps - I've updated the invoke.sh/bat scripts to allow the user to select the command-line or web UI (or a developer console, useful for debugging broken installations). And the install.sh/bat script now tells the user to run invoke.sh/bat after the installation has finished.

  2. Distribute installer zips instead of direct script files - This is to avoid users running the install.sh/bat script inside their Download or home folder, and having the entire repo explode into that folder. Another benefit of a zip is that we include a simple readme.txt to guide the user what to do. But mainly, this ensures that the install script is always run inside a new invokeAI folder.

I've added a script installer/create_installers.sh to automatically create the installer zips for the three OS platforms. This will be useful if you ever make changes to the installer and need to release new zips

@tildebyte tildebyte requested a review from lstein October 29, 2022 19:31
Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just run through the process and aside from pip taking forever it was smooth and painless. I particularly like the last step where it offers to launch invoke. The only issue there was that the models files weren't downloaded due to using the version of preload on main. I'm going to change the bat file's checkout branch to get the full experience.

@lstein lstein merged commit b774c8a into invoke-ai:development Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants