Closed moorepants closed 2 years ago
After creating this environment and letting mayavi use the default toolkit, the script works:
conda create -n mayavi python=3.6 "pyqt<5" "wxpython<4" mayavi ipython
But if I use the wx backend I get this error:
/home/moorepants/miniconda3/envs/mayavi/lib/python3.6/site-packages/pyface/wx/drag_and_drop.py:60: wxPyDeprecationWarning: Call to deprecated item. Use wx.DataFormat instead.
PythonObject = wx.CustomDataFormat('PythonObject')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-5968ab238904> in <module>()
7
8 from traits.api import HasTraits, Range, Instance, on_trait_change
----> 9 from traitsui.api import View, Item, Group
10
11 from mayavi.core.api import PipelineBase
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/api.py in <module>()
34
35 try:
---> 36 from .editors.api import ArrayEditor
37 except ImportError:
38 # ArrayEditor depends on numpy, so ignore if numpy is not present.
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/editors/__init__.py in <module>()
21
22 try:
---> 23 from .api import ArrayEditor
24 except ImportError:
25 pass
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/editors/api.py in <module>()
22 from .button_editor import ButtonEditor
23 from .check_list_editor import CheckListEditor
---> 24 from .code_editor import CodeEditor
25 from .color_editor import ColorEditor
26 from .compound_editor import CompoundEditor
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/editors/code_editor.py in <module>()
34 #-------------------------------------------------------------------------------
35
---> 36 class ToolkitEditorFactory ( EditorFactory ):
37 """ Editor factory for code editors.
38 """
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/editors/code_editor.py in ToolkitEditorFactory()
46
47 # Background color for marking lines
---> 48 mark_color = Color( 0xECE9D8 )
49
50 # Object trait containing the currently selected line (optional)
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traits/traits.py in __call__(self, *args, **metadata)
520
521 def __call__ ( self, *args, **metadata ):
--> 522 return self.maker_function( *args, **metadata )
523
524 class TraitImportError ( TraitFactory ):
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traits/traits.py in Color(*args, **metadata)
1234 from traitsui.toolkit_traits import ColorTrait
1235
-> 1236 return ColorTrait( *args, **metadata )
1237
1238 Color = TraitFactory( Color )
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/toolkit_traits.py in ColorTrait(*args, **traits)
5
6 def ColorTrait ( *args, **traits ):
----> 7 return toolkit().color_trait( *args, **traits )
8
9 def RGBColorTrait ( *args, **traits ):
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/toolkit.py in toolkit(*toolkits)
150 if ETSConfig.toolkit:
151 # If a toolkit has already been set for ETSConfig, then use it:
--> 152 _toolkit = _import_toolkit(ETSConfig.toolkit)
153 return _toolkit
154 else:
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/toolkit.py in _import_toolkit(name)
81
82 def _import_toolkit ( name ):
---> 83 return __import__( name, globals=globals(), level=1 ).toolkit
84
85
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/wx/__init__.py in <module>()
24 #-------------------------------------------------------------------------------
25
---> 26 from . import toolkit
27
28 # Reference to the GUIToolkit object for wxPython
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/wx/toolkit.py in <module>()
56 import PythonDropTarget
57
---> 58 from .constants \
59 import WindowColor, screen_dx, screen_dy
60
~/miniconda3/envs/mayavi/lib/python3.6/site-packages/traitsui/wx/constants.py in <module>()
59 BorderedGroupColor = wx.Colour( 224, 224, 224 )
60 else:
---> 61 WindowColor = wx.SystemSettings_GetColour( wx.SYS_COLOUR_MENUBAR )
62
63 # Standard width of an image bitmap
AttributeError: module 'wx' has no attribute 'SystemSettings_GetColour'
When I tried this in linux, the version of wxPython installed was 4.0.0rc1.dev3440+0f9b36e-py36_0 which would seem to be the source of the problem (wxPython 4 is not supported by traitsui
). The specific issue is this API change.
It seems like it may be a bug in conda
that 4.0.0rc1 is considered as satisfying "<4"? It does not look like conda-forge
has a version of wxPython older than this, though. defaults
has wxpython 3.0, but only for Python 2.7.
I've raised this behavior as unintuitive with @mcg1969 before. Prerelease versions are considered less than .0 releases. That's why conda build does its upper bounds as x.y.0a0
I don't know how prerelease versions really should be handled, though. The current way is ok once you know about it, but boy is it confusing until you do.
On Nov 6, 2017 6:30 PM, "Gregory R. Lee" notifications@github.com wrote:
When I tried this in linux, the version of wxPython installed was 4.0.0rc1.dev3440+0f9b36e-py36_0 which would seem to be the source of the problem (wxPython 4 is not supported by traitsui). The specific issue is this API change https://docs.wxpython.org/MigrationGuide.html#static-methods.
It seems like it may be a bug in conda that 4.0.0rc1 is considered as satisfying "<4"? It does not look like conda-forge has a version of wxPython older than this, though. defaults has wxpython 3.0, but only for Python 2.7.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/conda-forge/mayavi-feedstock/issues/16#issuecomment-342334718, or mute the thread https://github.com/notifications/unsubscribe-auth/AACV-aDdWcFVPBCbWwg34OysD0cRqhPcks5sz6SQgaJpZM4QT_1y .
Prerelease versions are considered less than .0 releases.
I suspected that might be the explanation, but it seems like most users would naively expect "<4" to give the most recent 3.x release!
@moorepants I should also mention that wxPython 3 does not support Python 3 so the lack of packages there is not a limitation of conda-forge. The only current solution for using Mayavi with a wx backend would appear to be to run Python 2.7. I don't know if enthought is in the progress of updating their tools to use wx 4.0, but as of now it does not appear to be supported in mayavi's dependencies (pyface, traitsui).
Frankly I agree with the intuition here. For some vague reason I seem to remember the relevant PEP standards disagreeing with us here. But if so, maybe we just acknowledge that it is better to violate the standard.
For some vague reason I seem to remember the relevant PEP standards disagreeing with us here. But if so, maybe we just acknowledge that it is better to violate the standard.
This section of PEP440 at one point states:
The exclusive ordered comparison <V MUST NOT allow a pre-release of the specified version unless the specified version is itself a pre-release. Allowing pre-releases that are earlier than, but not equal to a specific pre-release may be accomplished by using <V.rc1 or similar.
However, later in that document it seems to say that a pre-release will be used if there is no non-prerelease version that matches. I think that would be the case that occurs here (There is only a pre-release of the package available): https://www.python.org/dev/peps/pep-0440/#handling-of-pre-releases
I guess the question is if conda-forge
had a non pre-release 3.0 package for python 3.0 would that one have been returned instead of 4.0rc1? If so, then it is probably a pretty rarely encountered problem.
I guess i can just specify wxpython=3.*
or something like that.
Yes, I see now that wxpython is only for python 2.7:
wxpython 3.0.0.0 py27_0 defaults
3.0.0.0 py27_2 defaults
4.0.0a3 py27_0 conda-forge
4.0.0a3 py35_0 conda-forge
4.0.0a3 py36_0 conda-forge
4.0.0b2 py27_0 conda-forge
4.0.0b2 py35_0 conda-forge
4.0.0b2 py36_0 conda-forge
4.0.0rc1.dev3440+0f9b36e py27_0 conda-forge
* 4.0.0rc1.dev3440+0f9b36e py35_0 conda-forge
4.0.0rc1.dev3440+0f9b36e py36_0 conda-forge
I can run Python 2.7.
Why are prereleases even in a my conda-forge channel? Shouldn't they only be accessible if I want to install prereleases? Seems like we should keep prereleases hidden to endusers by default.
Closing as the original issue seems to be due to not having GL rendering setup (e.g., with xvfb). We can reopen if people are still having problems with this, but I think it's likely to be a Mayavi/headless rendering issue rather than one with the recipe itself
See: