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

[enhancement]: on Windows, make use of the 'py' command line launcher, if available #3303

Open
1 task done
gogurtenjoyer opened this issue Apr 29, 2023 · 1 comment
Open
1 task done
Labels
enhancement New feature or request install

Comments

@gogurtenjoyer
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Contact Details

No response

What should this feature add?

On every operating system but Windows, we're able to make some assumptions about which python version we're referring to by being specific, such that we know python3.10 -V will return something along the lines of Python 3.10.x. On Windows, for whatever reason, this is not the case, as all python interpreters are named python.exe.

Currently, InvokeAI's automated installer requires a non-default option, 'Add python.exe to PATH', to be checked when installing the official package from python.org, or it'll fail. This is responsible for the vast majority of support issues that we see, and probably the popularity of the standalone version which was recently removed from itch.io. In addition, this option could inadvertently break the installation of other python-requiring software that also made this choice/requirement.

There's already a solution for this, and it's the py launcher that comes with every python installation from python.org. It accepts a version as the first argument to it, and is available in PATH without any non-default options checked. An example:

py -3.10 -V would be the same as python3.10 -V, and
py -3.10 -m pip install xformers would be the same as python3.10 -m pip install xformers.

This should hopefully be pretty easy to implement in the installer and would save many, many people a lot of time.

Alternatives

Not so much an alternative, but a counterpoint: the py launcher isn't included with the python from the microsoft store, so this proposal wouldn't help there.

An alternative might be to just require that the end user chooses the right python to launch the installer, with some documentation explaining the various ways to provide that, depending upon how python was installed.

Aditional Content

No response

@gogurtenjoyer gogurtenjoyer added the enhancement New feature or request label Apr 29, 2023
@Millu Millu added the install label Feb 14, 2024
@gogurtenjoyer
Copy link
Contributor Author

gogurtenjoyer commented Sep 24, 2024

Reviving this issue because I now have a Windows PC to test on once again. I've created a quick hack of install.bat (not install.bat.in) from the latest 5.0 installer.

Replacing python with py -3.11 in two places works fine as a proof of concept:

line 45:

call py -3.11 --version >.tmp1 2>.tmp2

line 68:

call py -3.11 .\lib\main.py

My guess is that somebody that's actually familiar with .bat files could make this more elegant and check for py 3.11 and, if not found, try py 3.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request install
Projects
None yet
Development

No branches or pull requests

2 participants