ValueError: API 'QString' has already been set to version 1

Showing 1-4 of 4 messages
ValueError: API 'QString' has already been set to version 1 PeterT 1/18/11 2:30 PM

I have the enthought suite installed via svn build (http:// importing mlab works fin from a non-spyder
shell python or Ipython shell using:

from enthought.mayavi import mlab

however attempting to import mlab using spyders imbedded shell (either
IPyton or Python) results in the following error:

In [1]: from enthought.mayavi import mlab
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
  File "<homedir>/src/ETS/Mayavi/enthought/mayavi/", line 27,
in <module>
    from import view, roll, yaw, pitch,
  File "<homedir>/src/ETS/Mayavi/enthought/mayavi/tools/",
line 23, in <module>
    from engine_manager import get_engine
  File "<homedir>/src/ETS/Mayavi/enthought/mayavi/tools/", line 12, in <module>
    from enthought.mayavi.preferences.api import preference_manager
  File "<homedir>/src/ETS/Mayavi/enthought/mayavi/preferences/",
line 4, in <module>
    from preference_manager import preference_manager
  File "<homedir>/src/ETS/Mayavi/enthought/mayavi/preferences/", line 29, in <module>
    from enthought.traits.ui.api import View, Group, Item
  File "<homedir>/src/ETS/Traits/enthought/traits/ui/", line 35,
in <module>
    from .editors.api import (ArrayEditor, BooleanEditor,
  File "<homedir>/src/ETS/Traits/enthought/traits/ui/editors/", line 22, in <module>
    from .api import (toolkit, ArrayEditor, BooleanEditor,
  File "<homedir>/src/ETS/Traits/enthought/traits/ui/editors/",
line 10, in <module>
    from .code_editor import CodeEditor
  File "<homedir>/src/ETS/Traits/enthought/traits/ui/editors/", line 36, in <module>
    class ToolkitEditorFactory ( EditorFactory ):
  File "<homedir>/src/ETS/Traits/enthought/traits/ui/editors/", line 48, in ToolkitEditorFactory
    mark_color = Color( 0xECE9D8 )
  File "<homedir>/src/ETS/Traits/enthought/traits/", line
486, in __call__
    return self.maker_function( *args, **metadata )
  File "<homedir>/src/ETS/Traits/enthought/traits/", line
1182, in Color
    return ColorTrait( *args, **metadata )
  File "<homedir>/src/ETS/Traits/enthought/traits/ui/", line 7, in ColorTrait
    return toolkit().color_trait( *args, **traits )
  File "<homedir>/src/ETS/Traits/enthought/traits/ui/", line
109, in toolkit
    _toolkit = _import_toolkit(ETSConfig.toolkit)
  File "<homedir>/src/ETS/Traits/enthought/traits/ui/", line
51, in _import_toolkit
    return __import__( name, globals=globals(), level=1 ).toolkit
  File "<homedir>/src/ETS/TraitsBackendQt/enthought/traits/ui/qt4/", line 18, in <module>
    import enthought.qt.api
  File "<homedir>/src/ETS/EnthoughtBase/enthought/qt/", line 22,
in <module>
    sip.setapi('QString', 2)
ValueError: API 'QString' has already been set to version 1

there seems to be reference to a problem like this that was solved for
some after version version 1.1.0rc2 (
) hwever, im using the
hg repository.

I am on linux (Ubuntu 10.10) x64

Thanks in advance for any assistance.


PS. I use spyder every day and am exceedingly impressed/happy with it,

Re: ValueError: API 'QString' has already been set to version 1 Pierre Raybaut 2/16/11 1:15 PM

Thanks for taking the time to report this unexpected behavior, for
using Spyder and for your enthousiasm regarding the project.

Apparently, the Enthought package is using the API #2 of PyQt whereas
Spyder is using API #1. Spyder needs to import PyQt when opening any
console (when opening a stand-alone Python/IPython interpreter or when
running a Python script) to provide code introspection features (code
completion, variable explorer). If you don't need these features, you
may disable the 'Monitor' in Console preferences ('Advanced').
Moreover, it is necessary to disable the Matplotlib patch ('External
modules' tab of console preferences). Then, it should work in any
Python interpreter. As for IPython, you may have to remove the 'pylab'
option which could import PyQt if it has been defined as the
Matplotlib's backend.

I've already successfully tested this on Ubuntu 10.10.

I realize that it is a bit complicate but hopefully things will be
much simpler when every single package will be using the same PyQt
API. Spyder should switch from API #1 to API #2 this year.

Re: ValueError: API 'QString' has already been set to version 1 Pierre Raybaut 3/2/11 12:39 PM

As reported here:
this problem is happening with the new Enthougth Tool Suite plugin
shipped with the latest Python(x,y) beta version (v2.6.6.0beta1).

I've just fixed this issue by adding a new option in Spyder ("Ignore
PyQt API change errors") which is enabled by default:

So now, in Spyder development version (which may be installed easily
on any platform), this issue is fixed.

Re: ValueError: API 'QString' has already been set to version 1 Peter Tittmann 3/2/11 12:49 PM
Thanks Pierre!

Peter Tittmann

You received this message because you are subscribed to the Google Groups "spyder" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at