Python: Loading mayavi.mlab throws Attribute Error probably from QT. Loading mayavi works fine

Viewed 831

I'm using Python 3.8.8 on MacOS and am trying to load mayavi.mlab to draw some 3D plots.

The line

import mayavi

works, however the line

import mayavi.mlab throws the error

~/opt/anaconda3/lib/python3.8/site-packages/pyface/ui/qt4/dialog.py in <module>
     27 # Map PyQt dialog related constants to the pyface equivalents.
     28 _RESULT_MAP = {
---> 29     int(QtGui.QDialog.DialogCode.Accepted): OK,
     30     int(QtGui.QDialog.DialogCode.Rejected): CANCEL,
     31     int(QtGui.QMessageBox.StandardButton.Ok): OK,

AttributeError: type object 'DialogCode' has no attribute 'Accepted'

I installed PyQT5

pip install PyQT5

in the hope that it helps, the error indeed changed.

Now import mayavi.mlab throws

~/opt/anaconda3/lib/python3.8/site-packages/pyface/qt/QtWebKit.py in <module>
     17 
     18     try:
---> 19         from PyQt5.QtWebEngine import *
     20         from PyQt5.QtWebEngineWidgets import (
     21             QWebEngineHistory as QWebHistory,

ValueError: PyCapsule_GetPointer called with incorrect name

browsing a bit on the internet, I saw that a similar error could be fixed by downgrading down to PyQT 5.9.2 through conda.

pip uninstall PyQT # installed previously was PyQT 5.15.1
 
conda install PyQT # now installed PyQT 5.9.2

Throwing again the error

[...]
AttributeError: type object 'DialogCode' has no attribute 'Accepted'

I think I'm mainly looking for which version of PyQT (and dependencies) to use with mayavi.mlab

0 Answers
Related