openmc-dev / plotter

Native plotting GUI for model design and verification
MIT License
46 stars 18 forks source link

Python 3.11 is not supported #120

Closed alexbkv closed 3 months ago

alexbkv commented 1 year ago

Hello, everyone! I am trying to launch openmc-plotter and get the following error:

TypeError: 'PySide2.QtCore.Qt.Alignment' object cannot be interpreted as an integer
/home/alx8kv/venvs/env/lib/python3.11/site-packages/openmc_plotter/__main__.py:52: RuntimeWarning: libshiboken: Overflow: Value <PySide2.QtCore.Qt.Alignment object at 0x7fe048710ef0> exceeds limits of type  [signed] "i" (4bytes).
  splash.showMessage("Loading Model...",
Traceback (most recent call last):
  File "/home/alx8kv/venvs/env/bin/openmc-plotter", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/alx8kv/venvs/env/lib/python3.11/site-packages/openmc_plotter/__main__.py", line 32, in main
    run_app(args)
  File "/home/alx8kv/venvs/env/lib/python3.11/site-packages/openmc_plotter/__main__.py", line 52, in run_app
    splash.showMessage("Loading Model...",
OverflowError

I use Debian in WSL2, if that has anything to do with that. Everything was installed with pip, rather than conda. If I am missing something, could you. please, point me in the right direction?

paulromano commented 1 year ago

Getting Linux GUI apps running correctly through WSL may be a bit challenging. Have you followed the directions in the link below for GUI app support? https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps

alexbkv commented 1 year ago

Yes, I have read that, and other GUI apps do work inside WSL. In the end, I was able to run openmc-plotter inside the develop-dagmc docker container, although I had to additionally install qtbase5-dev inside the image.

nplinden commented 1 year ago

I got the same error on a native Ubuntu 23.4 and another Ubuntu 20.4 machine. It seems like the reason is that PySide2 5.15.2.1 is not available for python3.11 and above, and pip installs PySide2 5.13.2 instead.

For some reason bitwise operations on Qt.Alignment flag objects seem broken on this version:

import PySide2
print(PySide2.__version__)
a = (PySide2.QtCore.Qt.AlignHCenter | PySide2.QtCore.Qt.AlignBottom)

returns:

5.13.2
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
TypeError: 'PySide2.QtCore.Qt.AlignmentFlag' object cannot be interpreted as an integer

Thats the error you are getting, as these operations are used to create the splash screen when launching openmc-plotter.

I don't know enough about PySide2 or Qt to propose an elegant fix to the problem, but I guess reverting to python3.10 fixes to issue (it did for me)

paulromano commented 1 year ago

I just updated the title here to reflect the fact that we rely on PySide2, which doesn't currently support Python 3.11 (or at least the wheels that are available on PyPI do not). See here for more details. Python 3.11 is supported as of 5.15.11 but PyPI only has 5.15.2 and earlier. I'm wondering if just switching to PySide6 (see #121) would give us an easier path to a working install on Python 3.11.

paulromano commented 3 months ago

Closed with #127