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

Compatibility with PySide6 QApplication() in Linux #3172

Closed
xwanner opened this issue Apr 15, 2024 · 8 comments
Closed

Compatibility with PySide6 QApplication() in Linux #3172

xwanner opened this issue Apr 15, 2024 · 8 comments
Labels
wontfix This will not be worked on

Comments

@xwanner
Copy link

xwanner commented Apr 15, 2024

Description of the problem

I am writing an app with a UI made with PySide6 (i.e. Qt). The base command to generate the app is app = QApplication()

I cannot generate any figure when pygmt is ran after a QApplication() command.

PySide6 is installed via pip (I cannot install it via conda since the conda package is lacking some modules).

I don't have the issue in windows.

Minimal Complete Verifiable Example

This work :

from PySide6.QtWidgets import QApplication

import pygmt
fig = pygmt.Figure()
fig.coast(region=[-180, 180, -90, 90], shorelines=True, frame=True)
fig.show()

app = QApplication()

And this does not :

from PySide6.QtWidgets import QApplication

app = QApplication()

import pygmt
fig = pygmt.Figure()
fig.coast(region=[-180, 180, -90, 90], shorelines=True, frame=True)
fig.show()

Full error message

Error: /undefined in 0,06
Operand stack:
Execution stack:   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1933   1   3   %oparray_pop   1932   1   3   %oparray_pop   1917   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:   --dict:752/1123(ro)(G)--   --dict:0/20(G)--   --dict:85/200(L)--   --dict:150/250(L)--
Current allocation mode is local
Last OS error: No such file or directoryCurrent file position is 20867
psconvert [ERROR]: System call [gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/home/xwanner/.gmt/sessions/gmt_session.67849/gmt_1.ps-' 2> '/home/xwanner/.gmt/sessions/gmt_session.67849/psconvert_67849c.bb'] returned error 256.
Traceback (most recent call last):
  File "/home/xwanner/Documents/proj_FlightAnalyst/proj-ng/src/debug/test.py", line 10, in <module>
    fig.show()
  File "/home/xwanner/miniforge3/envs/proj-ng/lib/python3.11/site-packages/pygmt/figure.py", line 468, in show
    pdf = self._preview(
          ^^^^^^^^^^^^^^
  File "/home/xwanner/miniforge3/envs/proj-ng/lib/python3.11/site-packages/pygmt/figure.py", line 495, in _preview
    self.savefig(fname, dpi=dpi, **kwargs)
  File "/home/xwanner/miniforge3/envs/proj-ng/lib/python3.11/site-packages/pygmt/figure.py", line 374, in savefig
    self.psconvert(prefix=prefix, fmt=fmt, crop=crop, **kwargs)
  File "/home/xwanner/miniforge3/envs/proj-ng/lib/python3.11/site-packages/pygmt/helpers/decorators.py", line 603, in new_module
    return module_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xwanner/miniforge3/envs/proj-ng/lib/python3.11/site-packages/pygmt/helpers/decorators.py", line 776, in new_module
    return module_func(*bound.args, **bound.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xwanner/miniforge3/envs/proj-ng/lib/python3.11/site-packages/pygmt/figure.py", line 252, in psconvert
    lib.call_module(
  File "/home/xwanner/miniforge3/envs/proj-ng/lib/python3.11/site-packages/pygmt/clib/session.py", line 624, in call_module
    raise GMTCLibError(
pygmt.exceptions.GMTCLibError: Module 'psconvert' failed with status code 79:
psconvert [ERROR]: System call [gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/home/xwanner/.gmt/sessions/gmt_session.67849/gmt_1.ps-' 2> '/home/xwanner/.gmt/sessions/gmt_session.67849/psconvert_67849c.bb'] returned error 256.

System information

PyGMT information:
  version: v0.11.0
System information:
  python: 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:53:32) [GCC 12.3.0]
  executable: /home/xwanner/miniforge3/envs/proj-ng/bin/python
  machine: Linux-5.15.0-101-generic-x86_64-with-glibc2.35
Dependency information:
  numpy: 1.26.4
  pandas: 2.2.2
  xarray: 2024.3.0
  netCDF4: 1.6.5
  packaging: 24.0
  contextily: None
  geopandas: 0.14.3
  ipython: None
  rioxarray: None
  ghostscript: 10.03.0
GMT library information:
  binary version: 6.5.0
  cores: 8
  grid layout: rows
  image layout: 
  library path: /home/xwanner/miniforge3/envs/proj-ng/lib/libgmt.so
  padding: 2
  plugin dir: /home/xwanner/miniforge3/envs/proj-ng/lib/gmt/plugins
  share dir: /home/xwanner/miniforge3/envs/proj-ng/share/gmt
  version: 6.5.0
@xwanner xwanner added the bug Something isn't working label Apr 15, 2024
Copy link

welcome bot commented Apr 15, 2024

👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.

@seisman
Copy link
Member

seisman commented Apr 15, 2024

Your two scripts work well for me on Linux, but I installed PySide6 using conda, not pip.

@xwanner
Copy link
Author

xwanner commented Apr 15, 2024

Yes, I think the problem is with PySide6 installed from pip. I will try to post an isssue on the pyside git repo.

@seisman did you managed to use QWebEngineView with PySide6 installed from conda ?

@seisman
Copy link
Member

seisman commented Apr 15, 2024

I don't use PySide6, so I'm not sure, but following command fails, so I guess the answer is no.

>>> from PySide6.QtWebEngineWidgets import QWebEngineView
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PySide6.QtWebEngineWidgets'

@seisman
Copy link
Member

seisman commented Apr 15, 2024

As mentioned above, I've never used PySide6 and I also don't understand why PySide6 would make PyGMT fail. I may provide more help if you can upload the file /home/xwanner/.gmt/sessions/gmt_session.67849/gmt_1.ps- to GitHub.

@xwanner
Copy link
Author

xwanner commented Apr 15, 2024

gmt_1.zip

Here is the file.
But I am pretty sure since you tested it, that the problem comes from a local vs. global path conflict between conda and pip.

@seisman
Copy link
Member

seisman commented Apr 15, 2024

In your PS file, I see the following lines which cause troubles:

%%BeginPageSetup
V 0,06 0,06 scale
%%EndPageSetup

It should be V 0.06 0.06 scale instead. So it must be something "wrong" with the decimal separator.

@seisman seisman added wontfix This will not be worked on and removed bug Something isn't working labels Apr 16, 2024
@seisman
Copy link
Member

seisman commented Apr 17, 2024

I believe it's caused by the change in the system's LC settings, and there is nothing we can do on the PyGMT side. Closing the issue.

@seisman seisman closed this as completed Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants