Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updater #6285

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

feat: updater #6285

wants to merge 6 commits into from

Conversation

psychedelicious
Copy link
Collaborator

Summary

Similar to #6215, add update logic that fetches and runs the latest installer.

The main difference is that most of the logic in here is in a python script:

  • Check for new releases/prereleases
  • Advises user of current version and latest
  • Asks user if they want to update - if so, download and unzip the latest installer

The python script then ends and the invoke script picks up. All it needs to do is check if the install script exists, and if so, run it and exit.

This works as expected for the macOS/linux invoke.sh script.

I ported the logic to powershell and it mostly works, but there is some wonkiness when invokeai-web and the update helper exit. Powershell doesn't handle errors and exit codes (like when you Ctrl+C) for these non-.NET scripts nicely.

Depending on the combination of $ErrorActionPreference and whether or not you redirect stderr to stdout, you either catch every raised python error (including handled ones, bc they end up in stderr...) or none, and have to use a finally block to handle the signal from the python script. You cannot just catch the Ctrl+C and pass, letting the invoke script continue. If this sounds confusing, that's because it is.

Anyways, I'll revisit the powershell script later, maybe just write it in the batch file instead. Won't be hard, I just really wanted the powershell script to work bc it's so much more intelligible than batch.

Related Issues / Discussions

#6215

QA Instructions

Testing this is a bit convoluted. Two options:

  1. Use a built installer
  • Build an installer from this branch (e.g. make installer-zip).
  • Copy the wheel and the installer zip to the destination host.
  • Run the install script with --wheel InvokeAI-4.2.0a3-py3-none-any.whl to install from the wheel.
  • You should then have access to invokeai-web and invokeai-update-helper in your PATH, and the invoke launcher should work and update
  1. Use an editable install
  • Do a normal install from any version to set up the root dir scripts
  • Check out this branch on the destination host
  • Activate your normal install's venv
  • Manually install (e.g. pip install -e .) into the normal install's venv
  • Copy and paste the launcher scripts from the branch to the install root (e.g. copy invoke.sh.in to invoke.sh)
  • You should then have access to invokeai-web and invokeai-update-helper in your PATH, and the invoke launcher should work and update

Ok, so then to make this more annoying, once you successfully use the updater to install, you will necessarily end up with a venv that no longer has the update functionality. So to test again, you need to repeat those steps to re-install from this branch, with update functionality...

Merge Plan

This needs testing on multiple platforms (once the windows portion is working), and some coordination for releasing.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

We can add it back once it is updated and #6188 & #6103 are resolved.
- Python script checks for updates and download the latest installer if requested
- Add `packaging` to deps (we only have it as an indirect dep)
- Run the install helper
- If the user selected to update, and the installer was downloaded, we branch into a terminal code path that runs the installer
- Regardless of the exit status of the installer, the invoke.sh script exits and the user needs to restart
This version of powershell is supported on Windows 10 and above
@github-actions github-actions bot added python PRs that change python files Root installer PRs that change the installer python-deps PRs that change python dependencies labels Apr 28, 2024
@psychedelicious
Copy link
Collaborator Author

TODO

  • Add an option to installer to ignore the pip cache. Should mitigate issues with troublesome packages like controlnet_aux where sometimes a broken version is cached. See [bug]: ModuleNotFoundError: No module named 'controlnet_aux' #6365 (comment)
  • Consider making the launcher itself a python script. Would simplify the whole thing, but I'm unsure of the technicalities of activating a venv and running a python script within another python script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installer PRs that change the installer python PRs that change python files python-deps PRs that change python dependencies Root
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant