While the docs don't mention it explicitly, I guess it should be possible to run Mayavi in IPython (v. 2.0.0) with qt... but
$ ETS_TOOLKIT=qt4 ipython2 --gui=qt4 -c 'from mayavi import mlab'
<...>
/usr/lib/python2.7/site-packages/pyface/qt/__init__.py in prepare_pyqt4()
15 # Set PySide compatible APIs.
16 import sip
---> 17 sip.setapi('QString', 2)
18 sip.setapi('QVariant', 2)
19
ValueError: API 'QString' has already been set to version 1
Should be fine if you (1) install pyside and (2) either uninstall PyQt or also set QT_API=pyside
No! You simply have to set sip to API #2 before ipython starts it qt event loop (typically when importing matplotlib). You can do that using environment variables, comman line arguments or programatically.
Furthermore, if you use an IDE like spyder, you can set this automatically.
This may help: http://ipython.readthedocs.org/en/stable/interactive/reference.html#pyqt-and-pyside
Unsure if it's actually a bug, but it is not really communicative, so it's either a "fix by doc" or a "fix by error message" at least.
IMHO, this is not a bug but we should add this ipython doc link to mayavi doc and mention the --gui=qt
flag depends on the PySide/PyQt backend (at least here: http://docs.enthought.com/mayavi/mayavi/mlab.html and there are a couple of other places)
I now this is closed, but I don't want to open a new issue, since it looks solved. However, I tried to do everything I read here (changing ETS_TOOLKIT
and QT_API
) and in the links provided, but the error continues.
I'm using mayavi 4.5.0 py27_0
with python 2.7.12
, all installed via conda
. I tried using ipython
and also in jupyter notebook
, but it shows the same message (API 'QString' has already been set to version 1
).
I really don't know what I'm missing to solve this.
@victortxa -- can you also see the discussion in #532.