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

Mayavi with IPython and Qt #129

Closed
anntzer opened this issue Apr 11, 2014 · 7 comments · Fixed by #376
Closed

Mayavi with IPython and Qt #129

anntzer opened this issue Apr 11, 2014 · 7 comments · Fixed by #376
Labels

Comments

@anntzer
Copy link

anntzer commented Apr 11, 2014

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
@jdmarch
Copy link

jdmarch commented Apr 11, 2014

Should be fine if you (1) install pyside and (2) either uninstall PyQt or also set QT_API=pyside

@martindurant
Copy link

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.

@kitchoi
Copy link
Contributor

kitchoi commented Apr 26, 2016

@stefanoborini
Copy link
Contributor

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.

@kitchoi
Copy link
Contributor

kitchoi commented Apr 29, 2016

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)

@victortxa
Copy link

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.

@prabhuramachandran
Copy link
Member

@victortxa -- can you also see the discussion in #532.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants