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

fix: make GUI installs more robust and provide helpful messages #269

Open
wants to merge 2 commits into
base: mainline
Choose a base branch
from

Conversation

epmog
Copy link
Contributor

@epmog epmog commented Mar 31, 2024

What was the problem/requirement? (What/Why)

We've been encountering some edge-cases with the lazy installs of pyside on both Windows and Linux.

  1. Failure without a helpful error message if you don't have write permissions
  2. Finding a windows store installation before an actual installation
  3. Failure if the python.exe points to the Windows Store alias
  4. Failure if the python.exe was installed from the Windows Store
  5. Failure to install when using the system linux install (might not be fully accurate)

Failures we aren't fixing in here:
On Linux:

qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vkkhrdisplay, vnc, wayland-egl, wayland, xcb.

The QApplication is aborting, thus we can't catch this and provide helpful advice. The message isn't too bad, and there's lots of posts online. A user must install xcb-cursors as appropriate on their linux distro. The submitter installer may be able to bundle this in the future, but pypi users will need to do this regardless.

What was the solution? (How)

I've moved all the installation logic to an internal _ensure_pyside function that adds checks for all these different scenarios. If the executable appears to be a microsoft store executable, we add the --no-user flag so that we can install to a target

What is the impact of this change?

Users should hopefully be able to help themselves get the GUI components onto their machine!

How was this change tested?

On Linux:

  1. Didn't have permissions:
$ ./deadline config gui
Optional GUI components for deadline are unavailable. Would you like to install PySide? [y/N]: y
Unable to install GUI dependencies, you do not have the permissions to write to '/home/ec2-user/Downloads/deadline-cloud-robust_windows_gui_install/out/cli'.
You can finish the install by running the following command as a user who can write to that folder

	/usr/bin/python3 -m pip install 'PySide6-essentials==6.6.*' --python-version 3.9 --only-binary=:all: --target /home/ec2-user/Downloads/deadline-cloud-robust_windows_gui_install/out/cli

Running that command with sudo allowed me to launch the deadline gui

On Windows:

  1. Didn't have permissions:
C:\Program Files\Locked Down Test>deadline config gui
Optional GUI components for deadline are unavailable. Would you like to install PySide? [y/N]: y
Unable to install GUI dependencies, you do not have the permissions to write to 'C:\Program Files\Locked Down Test\cli'.
You can finish the install by running the following command as a user who can write to that folder:

        C:\Users\epmog\AppData\Local\Microsoft\WindowsApps\python.EXE -m pip install PySide6-essentials==6.6.* --python-version 3.11 --only-binary=:all: --target C:\Program Files\Locked Down Test\cli --no-user

running that command as Admin allowed me to install the dependencies, and then I was able to launch the gui as the original user.

  1. microsoft store alias
$ ./deadline config gui
Optional GUI components for deadline are unavailable. Would you like to install PySide? [y/N]: y
running command: C:\Users\morgane\AppData\Local\Microsoft\WindowsApps\python.EXE -m pip install PySide6-essentials=
=6.6.* --python-version 3.11 --only-binary=:all: --target C:\users\morgane\dev\deadline-cloud\tmp\cli --no-user
The python install, C:\Users\morgane\AppData\Local\Microsoft\WindowsApps\python.EXE, is an alias to the Microsoft store.
To install AWS Deadline Cloud's GUI dependencies, install python and re-run this command.

after installing python from the windows store, I was able to re-run the command use the GUI

Was this change documented?

For the most part it is documentation.

Is this a breaking change?

Fixing!


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@epmog epmog force-pushed the robust_windows_gui_install branch 9 times, most recently from 9816a1e to acb37b7 Compare April 1, 2024 01:47
@epmog epmog changed the title fix: make windows GUI installs more robust fix: make GUI installs more robust Apr 1, 2024
@epmog epmog changed the title fix: make GUI installs more robust fix: make GUI installs more robust and provide helpful messages Apr 1, 2024
@epmog epmog marked this pull request as ready for review April 1, 2024 02:04
@epmog epmog requested a review from a team as a code owner April 1, 2024 02:04
@epmog epmog force-pushed the robust_windows_gui_install branch from acb37b7 to c8de8dd Compare April 1, 2024 02:05
moorec-aws
moorec-aws previously approved these changes Apr 1, 2024
src/deadline/client/ui/__init__.py Outdated Show resolved Hide resolved
src/deadline/client/ui/__init__.py Outdated Show resolved Hide resolved
src/deadline/client/ui/__init__.py Outdated Show resolved Hide resolved
src/deadline/client/ui/__init__.py Show resolved Hide resolved
src/deadline/client/ui/__init__.py Outdated Show resolved Hide resolved
Comment on lines +251 to +259
if "ModuleNotFoundError: No module named 'encodings'".lower() in result.stderr.lower():
# Occurred on deadline 0.46 - this seemed to happen when running on linux using /usr/bin/python3,
# could not reproduce when built on the same machine the install fails on.
# Debug info DOES indicate it's /usr/bin/python3 running and not happening within
# the deadline executable. Running the command manually also appears to work fine
click.echo("Unable to install GUI dependencies, you can fix this by running:")
click.echo()
click.echo(f"\t{printed_command}")
click.echo()
sys.exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if this happens because pyinstaller's bootstrapping sets some env vars that get inherited and picked up by the subprocess. In fact, it sounds a lot like this topic in their docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a great find! I'll look into applying the reversion of the environment changes

src/deadline/client/ui/__init__.py Show resolved Hide resolved
src/deadline/client/ui/__init__.py Outdated Show resolved Hide resolved
epmog and others added 2 commits April 1, 2024 11:15
Signed-off-by: Morgan Epp <[email protected]>

Co-authored-by: Josh Usiskin <[email protected]>
Co-authored-by: Charles Moore <[email protected]>
@epmog epmog force-pushed the robust_windows_gui_install branch from 1d58c25 to 6f09548 Compare April 1, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants