enthought / enthought/mayavi

Mayavi mlab error on MacOS Sequoia, Miniconda env: KeyError: 'pyface.toolkits'

Open
#1,343 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

I continually get an error when trying to set up my usual miniconda environment, on Mac OS 15.4 sequoia. Here is the .yml file used to define the environment:

```
name: myenv
channels:
- defaults
- conda-forge
dependencies:
- python
- vtk
- pyqt
- mayavi
- matplotlib
- pandas
- astropy
- scipy
- numpy
- dynesty
- fabric
- cartopy
- julian
- invoke
- pdoc3
- pexpect
- pytz
- spiceypy
- sysrsync
- tqdm
- h5py
- scikit-image
- scikit-learn
- jupyterlab
- statsmodels
- pip
- pip:
- twill
- idl_colorbars
```

I've tried this specifying pyqt=4, pyqt=5, not specifying python, specifying python=3.13, nothing works. It constantly produces this trace:

```
---------------------------------------------------------------------------
StopIteration Traceback (most recent call last)
File [~/miniconda3/envs/maven/lib/python3.13/importlib/metadata/__init__.py:262](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/importlib/metadata/__init__.py#line=261), in EntryPoints.__getitem__(self, name)
261 try:
--> 262 return next(iter(self.select(name=name)))
263 except StopIteration:

StopIteration:

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
Cell In[3], line 10
7 ETSConfig.toolkit = 'qt4'
9 from importlib import reload
---> 10 import maven_iuvs as iuvs
11 from pathlib import Path
12 from astropy.io import fits

File [~/Insync/erca8497](http://localhost:8888/lab/tree/notebooks/~/Insync/[/OneDrive](http://localhost:8888/OneDrive) Biz[/Research/IUVS/maven_iuvs/maven_iuvs/__init__.py:13](http://localhost:8888/Research/IUVS/maven_iuvs/maven_iuvs/__init__.py#line=12)
11 from . import miscellaneous
12 from . import spice
---> 13 from . import statistics
14 from . import time
15 from . import instrument

File [~/Insync/erca8497](http://localhost:8888/lab/tree/notebooks/~/Insync/](http://localhost:8888/OneDrive) Biz[/Research/IUVS/maven_iuvs/maven_iuvs/graphics/__init__.py:3](http://localhost:8888/Research/IUVS/maven_iuvs/maven_iuvs/graphics/__init__.py#line=2)
1 from .graphics import *
2 from .utilities import fig2rgb_array
----> 3 from .maven_orbit_image import maven_orbit_image, maven_orbit_summary
4 from .line_fit_plot import detector_image, LineFitPlot
5 from .echelle_graphics import run_quicklooks, quicklook_figure_skeleton, make_one_quicklook

File [~/Insync/erca8497](http://localhost:8888/lab/tree/notebooks/~/Insync/](http://localhost:8888/OneDrive) Biz[/Research/IUVS/maven_iuvs/maven_iuvs/graphics/maven_orbit_image.py:11](http://localhost:8888/Research/IUVS/maven_iuvs/maven_iuvs/graphics/maven_orbit_image.py#line=10)
8 import matplotlib.patheffects as path_effects
9 import matplotlib.patches as mpatches
---> 11 from mayavi import mlab
12 from tvtk.api import tvtk
14 from maven_iuvs import anc_dir

File [~/miniconda3/envs/maven/lib/python3.13/site-packages/mayavi/mlab.py:15](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/site-packages/mayavi/mlab.py#line=14)
1 """
2 mlab: a simple scripting interface to Mayavi2 for 3D plotting.
3
4 Can be used inside Mayavi2 itself, in "ipython --gui=qt", or in any
5 application with a compatible UI (Qt or wxPython).
6 """
8 # Author: Prabhu Ramachandran
9 # Gael Varoquaux
10 # Copyright (c) 2007-2020, Enthought, Inc.
(...) 13
14 # Mayavi imports
---> 15 from mayavi.core.common import process_ui_events
16 from mayavi.tools.camera import view, roll, yaw, pitch, move
17 from mayavi.tools.figure import figure, clf, gcf, savefig, \
18 draw, sync_camera, close, screenshot

File [~/miniconda3/envs/maven/lib/python3.13/site-packages/mayavi/core/common.py:21](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/site-packages/mayavi/core/common.py#line=20)
19 pyface = None
20 else:
---> 21 from pyface import api as pyface
23 # Setup a logger for this module.
24 logger = logging.getLogger(__name__)

File [~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/api.py:13](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/api.py#line=12)
1 # (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
2 # All rights reserved.
3 #
(...) 8 #
9 # Thanks for using Enthought open source!
11 import logging as _logging
---> 13 from .about_dialog import AboutDialog
14 from .application import Application
15 from .application_window import ApplicationWindow

File [~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/about_dialog.py:15](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/about_dialog.py#line=14)
11 """ The implementation of a simple 'About' dialog. """
14 # Import the toolkit specific version.
---> 15 from .toolkit import toolkit_object
17 AboutDialog = toolkit_object("about_dialog:AboutDialog")

File [~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/toolkit.py:23](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/toolkit.py#line=22)
19 from .base_toolkit import find_toolkit
22 # The toolkit function.
---> 23 toolkit = toolkit_object = find_toolkit("pyface.toolkits")

File [~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/base_toolkit.py:282](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/base_toolkit.py#line=281), in find_toolkit(entry_point, toolkits, priorities)
250 """ Find a toolkit that works.
251
252 If ETSConfig is set, then attempt to find a matching toolkit. Otherwise
(...) 279 some reason.
280 """
281 if ETSConfig.toolkit:
--> 282 return import_toolkit(ETSConfig.toolkit, entry_point)
284 entry_points = [
285 plugin for plugin in importlib_metadata.entry_points()[entry_point]
286 if toolkits is None or plugin.name in toolkits
287 ]
288 for plugin in sorted(entry_points, key=priorities):

File [~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/base_toolkit.py:216](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/site-packages/pyface/base_toolkit.py#line=215), in import_toolkit(toolkit_name, entry_point)
195 def import_toolkit(toolkit_name, entry_point="pyface.toolkits"):
196 """ Attempt to import an toolkit specified by an entry point.
197
198 Parameters
(...) 214 reason.
215 """
--> 216 entry_point_group = importlib_metadata.entry_points()[entry_point]
217 plugins = [
218 plugin for plugin in entry_point_group if plugin.name == toolkit_name
219 ]
220 if len(plugins) == 0:

File [~/miniconda3/envs/maven/lib/python3.13/importlib/metadata/__init__.py:264](http://localhost:8888/lab/tree/notebooks/~/miniconda3/envs/maven/lib/python3.13/importlib/metadata/__init__.py#line=263), in EntryPoints.__getitem__(self, name)
262 return next(iter(self.select(name=name)))
263 except StopIteration:
--> 264 raise KeyError(name)

KeyError: 'pyface.toolkits'
```

This is from an example where I specified the Python version, and where I tried inserting code suggested by a reply to [this similar issue](https://sourceforge.net/p/mayavi/discussion/84939/thread/56788977ce/). Nothing has worked. This environment has worked fine on a Linux machine for multiple years, but I am unable to verify the exact package versions on that machine right now because it's broken (this Mac is a temporary machine).

I've spent hours trying to troubleshoot this, redone the environment repeatedly, and I can't figure out what the problem is. Is this a bug, or have I missed something?

Thanks in advance

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the inline environment definition and reproduce the traceback from maven_iuvs/graphics/maven_orbit_image.py when it imports mayavi.mlab. Read the Mayavi and PyFace files named in the traceback, especially pyface/base_toolkit.py, and compare the installed Python, Mayavi, PyFace, and toolkit packages. Done means identifying the incompatible dependency or supported environment and documenting a reproducible fix or confirmed bug.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, macos, python
Domain
data-visualization, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.