Openmc-plotter Qt dylib error

After I’ve installed openmc-plotter, and I try to run it, I get this runtime error (below). Looks like there’s a conflict between PySide2’s Qt libraries (which was installed as part of the openmc-plotter’s dependencies) and another Qt lib (which was already installed in my conda env).

Note that I installed openmc-plotter with pip (as per the repo’s instructions), whereas I install everything else with conda. I thought that the two were interoperable, but I’m wondering if pip didn’t resolve the dependencies here ?

objc[79130]: Class QMacAutoReleasePoolTracker is implemented in both /Users/ronald/miniconda3/lib/python3.7/site-packages/PySide2/Qt/lib/QtCore.framework/Versions/5/QtCore (0x1114ed0f8) and /Users/ronald/miniconda3/lib/libQt5Core.5.12.9.dylib (0x1a1d62b538). One of the two will be used. Which one is undefined.
objc[79130]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Users/ronald/miniconda3/lib/python3.7/site-packages/PySide2/Qt/lib/QtCore.framework/Versions/5/QtCore (0x1114ed170) and /Users/ronald/miniconda3/lib/libQt5Core.5.12.9.dylib (0x1a1d62b5b0). One of the two will be used. Which one is undefined.
objc[79130]: Class KeyValueObserver is implemented in both /Users/ronald/miniconda3/lib/python3.7/site-packages/PySide2/Qt/lib/QtCore.framework/Versions/5/QtCore (0x1114ed198) and /Users/ronald/miniconda3/lib/libQt5Core.5.12.9.dylib (0x1a1d62b5d8). One of the two will be used. Which one is undefined.
objc[79130]: Class RunLoopModeTracker is implemented in both /Users/ronald/miniconda3/lib/python3.7/site-packages/PySide2/Qt/lib/QtCore.framework/Versions/5/QtCore (0x1114ed1e8) and /Users/ronald/miniconda3/lib/libQt5Core.5.12.9.dylib (0x1a1d62b628). One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7ffc7af0fca0) is not the object's thread (0x7ffc7ac8b8c0).
Cannot move to target thread (0x7ffc7af0fca0)

You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" 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: cocoa, minimal, offscreen, webgl.

Yes, I suspect some of the libraries come from different versions and are conflicting. Is it possible to install PySide2 from conda before running pip install on the plotter? That should prevent pip from installing it from PyPA.

Thanks, that helped.

First, I uninstalled the following, which had been installed via pip along with openmc-plotter

  • openmc-plotter
  • pyside2
  • pyqt5-sip
  • pyqtchart
  • pyqtwebengine
  • shiboken2

Then I installed pyside2 via conda. v5.13 is in conda forge

Then I installed openmc-plotter via pip. It installed the following:

  • PySide2-5.15.0
  • openmc-plotter-0.1.0
  • shiboken2-5.15.0

So pip decided to install a newer version of PySide, but it didn’t install any more Qt libraries.

Now openmc-plotter works!

2 Likes

Hi All,

I was not able to run the plotter, openmc-plotter even though it looks like all the requested libraries are being installed correctly. Currently, the error I am getting is in “shibiken2” even though the successful installation of openmc-plotter prints the message “Successfully installed PySide2-5.15.2 openmc-plotter-0.1.1 shiboken2-5.15.2” at its end. I followed all the procedures documented in this thread, but I still wasn’t able to make it work.

Here is the error message I get when I try to run the plotter:

PySide2/init.py: Unable to import shiboken2 from /home/xmi/anaconda3/envs/openmc-env/bin, /home/xmi/anaconda3/envs/openmc-env/lib/python39.zip, /home/xmi/anaconda3/envs/openmc-env/lib/python3.9, /home/xmi/anaconda3/envs/openmc-env/lib/python3.9/lib-dynload, /home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages
Traceback (most recent call last):
File “/home/xmi/anaconda3/envs/openmc-env/bin/openmc-plotter”, line 5, in
from openmc_plotter.main import main
File “/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc_plotter/main.py”, line 8, in
from PySide2 import QtCore, QtGui
File “/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/PySide2/init.py”, line 107, in
_setupQtDirectories()
File “/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/PySide2/init.py”, line 58, in _setupQtDirectories
import shiboken2
File “/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/shiboken2/init.py”, line 30, in
_init_pyside_extension()
NameError: name ‘_init_pyside_extension’ is not defined

Thank you

Ahmad

Just searching online, it sounds like this is some kind of version mismatch with PySide2. See the following:

https://forum.freecadweb.org/viewtopic.php?f=4&t=57786&p=496662#p496662

There are some additional things you should consider before installing plotter because version mismatch happens quite often between pip (comes with pyside2-5.15) and conda (pyside2-5.12)
And make sure you didn’t install pyside2 (5.12) accidentally by default using conda.

Remove unused packages and caches.

conda clean --all
pip cache purge  # To remove all the wheel files in the cache.

# Install plotter
pip install --no-cache-dir .  # `--no-cache-dir` option is used to avoid using the cache by pip.

Thank you very much guys. Thanks to your very helpful feedback, I think I am making progress, but I got stuck at another library, “pyqt5”, which I think is required by the backend of matplotlib.

Based on your comments, I did:

$ pip uninstall pyside2
The result was Successfully uninstalled PySide2-5.15.2

then
$ pip install pyside2==5.13.0

I chose version 5.13 because I got an error message when I tried another version:
ERROR: Could not find a version that satisfies the requirement pyside2==5.15.0 (from versions: 0.0.0a1, 5.11.0, 5.11.1, 5.11.2, 5.12.0, 5.12.1, 5.12.2, 5.12.3, 5.12.4, 5.12.5, 5.12.6, 5.13.0, 5.13.1, 5.13.2, 5.15.1, 5.15.2)

Now, when I try to run openmc-plotter, I get an error, ImportError: cannot import name ‘is_pyqt5’ from ‘matplotlib.backends.qt_compat’ (/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/matplotlib/backends/qt_compat.py).

Here is the full errors messages I am getting:
Traceback (most recent call last):
File “/home/xmi/anaconda3/envs/openmc-env/bin/openmc-plotter”, line 5, in
from openmc_plotter.main import main
File “/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc_plotter/main.py”, line 11, in
from .main_window import MainWindow, _openmcReload
File “/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc_plotter/main_window.py”, line 24, in
from .plotgui import PlotImage, ColorDialog
File “/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc_plotter/plotgui.py”, line 9, in
from matplotlib.backends.qt_compat import is_pyqt5
ImportError: cannot import name ‘is_pyqt5’ from ‘matplotlib.backends.qt_compat’ (/home/xmi/anaconda3/envs/openmc-env/lib/python3.9/site-packages/matplotlib/backends/qt_compat.py)

Thank you again

Ahmad

@Ahmad comment out the following line

1 Like

That worked :slight_smile: . Thank you very much Pranto.

That worked :slight_smile: . Thank you very much Pranto.

Thank you for the installation guidelines. I had the same problem, I followed your guidelines and now it’s working :grinning: