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

Attempting to run Python script displays QT error #32

Open
Nightsphere opened this issue Jul 13, 2021 · 6 comments
Open

Attempting to run Python script displays QT error #32

Nightsphere opened this issue Jul 13, 2021 · 6 comments
Assignees
Labels
bug critical Priority: highest priority XS Size: 2 hours or less

Comments

@Nightsphere
Copy link
Collaborator

When sudo python3 SNODASDaily_Interactive is ran in the GCP VM terminal, the following error is displayed:

image

It seems like a QT issue, but more research will be done to determine what exactly is the problem.

@Nightsphere Nightsphere added bug critical Priority: highest priority XS Size: 2 hours or less labels Jul 13, 2021
@Nightsphere Nightsphere self-assigned this Jul 13, 2021
@smalers
Copy link
Contributor

smalers commented Jul 13, 2021

This is related to trying to run QGIS (which uses Qt for UI) in a headless mode on the GCP server. In general, UI programs are able to run in headless mode but may need some configuration because program output is not actually going to a display (there is no physical display).

There are two initial questions to start with:

  1. When running the processing on a Ubuntu machine with UI desktop (like the development VM), how does QGIS Python use X window environment and can the environment be configured to better mimic the GCP VM to force headless? Can it be made headless and still work?
  2. When running the processing on the GCP VM, does it use X windows and is some additional configuration necessary to enable headless windows environment? It appears that the QGIS installer causes an install of Qt. Does it also install x window software on the GCP machine?

Note that TSTool will also need to be tested in headless mode. It has worked before in headless mode.

I found the following:

If X windows is running on GCP and is used to support QGIS and TSTool, it should be possible to ssh -Y to the GCP machine similar to cygwin/Dev machine and run a basic program like xclock, as long as xclock, etc. is installed.

@smalers
Copy link
Contributor

smalers commented Jul 13, 2021

Also the following discusses QGIS server. We don't need that (QGIS desktop should be enough), but the following indicates installing QGIS Server on a machine with X Windows. and says that QGIS is used by the server. So, I think we need to make sure that the X window server software is installed on the GCP machine.

https://docs.qgis.org/3.16/en/docs/server_manual/getting_started.html

@smalers
Copy link
Contributor

smalers commented Jul 13, 2021

See also information about enabling a virtual display device on GCP compute engine. This may be needed.

https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display

@smalers
Copy link
Contributor

smalers commented Jul 14, 2021

We confirmed that X windows is running on the server and were able to ssh in and run xclock and qgis and display back to the local computer. Need to confirm that the full process works in command line an cron headless mode but at least X programs should run.

@Nightsphere
Copy link
Collaborator Author

Nightsphere commented Jul 14, 2021

I had forgotten to add localhost since it was in a different terminal instance. After that was added, it's working now!
To be more clear I should say that the program starts, accepts input and starts on the first day. I'm getting a Java error right now when TSTool is run:

image

Steps to recreate are:

  1. Make sure X server is set up correctly.
  2. Log into GCP VM as snodas.
  3. Type: cd /var/opt/snodas-tools/scripts
  4. Run: python3 SNODASDaily_Interactive.py

@smalers
Copy link
Contributor

smalers commented Jul 15, 2021

First I edited the tstool script as indicated in its comments to use -Djava.awt.headless=true on the command line. This is not ideal because the UI version of TSTool cannot be run. I am going to update the command line parsing in the tstool script so that a --headless option can be used. Then that option can be specified in the SNODAS tools configuration file and the normal tstool script will work for UI and headless mode. Keep this issue open until this change is implemented.

This caused another error described in the following article.

microsoft/vscode-arduino#644

I made the change to /etc/java-8-openjdk/accessibility.properties, as follows:

#
# The following line specifies the assistive technology classes
# that should be loaded into the Java VM when the AWT is initialized.
# Specify multiple classes by separating them with commas.
# Note: the line below cannot end the file (there must be at
# a minimum a blank line following it).
#
# Steve Malers, 2021-07-15, commented out this line because it causes the following error with TSTool:
#   https://github.com/microsoft/vscode-arduino/issues/644
#assistive_technologies=org.GNOME.Accessibility.AtkWrapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug critical Priority: highest priority XS Size: 2 hours or less
Projects
None yet
Development

No branches or pull requests

2 participants