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

3,585 views
Skip to first unread message

PeterT

unread,
Jan 18, 2011, 5:30:53 PM1/18/11
to spyder
Hi,

I have the enthought suite installed via svn build (http://
code.enthought.com/source/) 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/mlab.py", line 27,
in <module>
from enthought.mayavi.tools.camera import view, roll, yaw, pitch,
move
File "<homedir>/src/ETS/Mayavi/enthought/mayavi/tools/camera.py",
line 23, in <module>
from engine_manager import get_engine
File "<homedir>/src/ETS/Mayavi/enthought/mayavi/tools/
engine_manager.py", line 12, in <module>
from enthought.mayavi.preferences.api import preference_manager
File "<homedir>/src/ETS/Mayavi/enthought/mayavi/preferences/api.py",
line 4, in <module>
from preference_manager import preference_manager
File "<homedir>/src/ETS/Mayavi/enthought/mayavi/preferences/
preference_manager.py", line 29, in <module>
from enthought.traits.ui.api import View, Group, Item
File "<homedir>/src/ETS/Traits/enthought/traits/ui/api.py", line 35,
in <module>
from .editors.api import (ArrayEditor, BooleanEditor,
ButtonEditor,
File "<homedir>/src/ETS/Traits/enthought/traits/ui/editors/
__init__.py", line 22, in <module>
from .api import (toolkit, ArrayEditor, BooleanEditor,
ButtonEditor,
File "<homedir>/src/ETS/Traits/enthought/traits/ui/editors/api.py",
line 10, in <module>
from .code_editor import CodeEditor
File "<homedir>/src/ETS/Traits/enthought/traits/ui/editors/
code_editor.py", line 36, in <module>
class ToolkitEditorFactory ( EditorFactory ):
File "<homedir>/src/ETS/Traits/enthought/traits/ui/editors/
code_editor.py", line 48, in ToolkitEditorFactory
mark_color = Color( 0xECE9D8 )
File "<homedir>/src/ETS/Traits/enthought/traits/traits.py", line
486, in __call__
return self.maker_function( *args, **metadata )
File "<homedir>/src/ETS/Traits/enthought/traits/traits.py", line
1182, in Color
return ColorTrait( *args, **metadata )
File "<homedir>/src/ETS/Traits/enthought/traits/ui/
toolkit_traits.py", line 7, in ColorTrait
return toolkit().color_trait( *args, **traits )
File "<homedir>/src/ETS/Traits/enthought/traits/ui/toolkit.py", line
109, in toolkit
_toolkit = _import_toolkit(ETSConfig.toolkit)
File "<homedir>/src/ETS/Traits/enthought/traits/ui/toolkit.py", line
51, in _import_toolkit
return __import__( name, globals=globals(), level=1 ).toolkit
File "<homedir>/src/ETS/TraitsBackendQt/enthought/traits/ui/qt4/
__init__.py", line 18, in <module>
import enthought.qt.api
File "<homedir>/src/ETS/EnthoughtBase/enthought/qt/api.py", 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 (http://groups.google.com/group/
spyderlib/browse_thread/thread/dce9b160579ae20d) hwever, im using the
hg repository.

I am on linux (Ubuntu 10.10) x64

Thanks in advance for any assistance.

Peter

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




Pierre Raybaut

unread,
Feb 16, 2011, 4:15:08 PM2/16/11
to spyder
Hi,

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.

Cheers,
Pierre

Pierre Raybaut

unread,
Mar 2, 2011, 3:39:40 PM3/2/11
to spyder
Hi,

As reported here:
http://code.google.com/p/pythonxy/issues/detail?id=232
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:
http://code.google.com/p/spyderlib/source/detail?r=4fb9a89c6320719280b87b6583823cb9e7736432

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

Cheers,
Pierre

Peter Tittmann

unread,
Mar 2, 2011, 3:49:42 PM3/2/11
to spyd...@googlegroups.com
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 spyd...@googlegroups.com.
To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.

Reply all
Reply to author
Forward
0 new messages