Skip to content

from mayavi import mlab error #1341

@oscariglesias

Description

@oscariglesias

I installed mayavi from anaconda notebook using pip install mayavi and the other required packages, but when I run

%gui qt
import vtk
import numpy as np
import mayavi
from mayavi import mlab
import os
mlab.options.backend = 'envisage'

in a Jupyter notebook, I get the following error message. Any hint on how to solve it?


ModuleNotFoundError Traceback (most recent call last)
Cell In[5], line 5
3 import numpy as np
4 #import mayavi
----> 5 from mayavi import mlab
6 import os
7 mlab.options.backend = 'envisage'

File ~\AppData\Local\anaconda3\Lib\site-packages\mayavi\mlab.py:16
8 # Author: Prabhu Ramachandran [email protected]
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
19 from mayavi.tools.engine_manager import get_engine, show_pipeline,
20 options, set_engine

File ~\AppData\Local\anaconda3\Lib\site-packages\mayavi\tools\camera.py:24
20 from numpy import pi
22 # We can't use gcf, as it creates a circular import in camera management
23 # routines.
---> 24 from .engine_manager import get_engine
27 def world_to_display(x, y, z, figure=None):
28 """ Converts 3D world coordinates to screenshot pixel coordinates.
29
30 Parameters
(...)
46 Screenshot y coordinate
47 """

File ~\AppData\Local\anaconda3\Lib\site-packages\mayavi\tools\engine_manager.py:13
10 from traits.api import HasTraits, Instance
12 # Local imports
---> 13 from mayavi.preferences.api import preference_manager
14 from mayavi.core.registry import registry
15 from mayavi.core.engine import Engine

File ~\AppData\Local\anaconda3\Lib\site-packages\mayavi\preferences\api.py:4
1 """The public API for the preferences."""
3 # The global PreferenceManager instance
----> 4 from .preference_manager import preference_manager
5 from .bindings import set_scene_preferences, get_scene_preferences

File ~\AppData\Local\anaconda3\Lib\site-packages\mayavi\preferences\preference_manager.py:128
122 helper.preferences = preferences
125 ##########################################################
126 # A Global preference manager that all other modules can use.
--> 128 preference_manager = PreferenceManager()

File ~\AppData\Local\anaconda3\Lib\site-packages\mayavi\preferences\preference_manager.py:81, in PreferenceManager.init(self, **traits)
78 super(PreferenceManager, self).init(**traits)
80 if 'preferences' not in traits:
---> 81 self._load_preferences()

File ~\AppData\Local\anaconda3\Lib\site-packages\mayavi\preferences\preference_manager.py:112, in PreferenceManager._load_preferences(self)
109 pref_file = pkg_resources.resource_stream(pkg, pref)
111 preferences = self.preferences
--> 112 default = preferences.node('default/')
113 default.load(pref_file)
114 pref_file.close()

File ~\AppData\Local\anaconda3\Lib\site-packages\apptools\preferences\scoped_preferences.py:221, in ScopedPreferences.node(self, path)
219 if self._path_contains_scope(path):
220 scope_name, path = self._parse_path(path)
--> 221 node = self._get_scope(scope_name)
223 # Otherwise, get the node from the primary scope.
224 else:
225 node = self._get_primary_scope()

File ~\AppData\Local\anaconda3\Lib\site-packages\apptools\preferences\scoped_preferences.py:406, in ScopedPreferences._get_scope(self, scope_name)
399 def _get_scope(self, scope_name):
400 """Return the scope with the specified name.
401
402 Raise a 'ValueError' is no such scope exists.
403
404 """
--> 406 scope = self.get_scope(scope_name)
407 if scope is None:
408 raise ValueError("no such scope %s" % scope_name)

File ~\AppData\Local\anaconda3\Lib\site-packages\apptools\preferences\scoped_preferences.py:373, in ScopedPreferences.get_scope(self, scope_name)
366 def get_scope(self, scope_name):
367 """Return the scope with the specified name.
368
369 Return None if no such scope exists.
370
371 """
--> 373 for scope in self.scopes:
374 if scope_name == scope.name:
375 break

File ~\AppData\Local\anaconda3\Lib\site-packages\apptools\preferences\scoped_preferences.py:357, in ScopedPreferences._scopes_default(self)
353 def _scopes_default(self):
354 """ Trait initializer. """
356 scopes = [
--> 357 Preferences(
358 name="application",
359 filename=self.application_preferences_filename,
360 ),
361 Preferences(name="default"),
362 ]
364 return scopes

File ~\AppData\Local\anaconda3\Lib\site-packages\apptools\preferences\preferences.py:91, in Preferences.init(self, **traits)
89 # If a filename has been specified then load the preferences from it.
90 if len(self.filename) > 0:
---> 91 self.load()

File ~\AppData\Local\anaconda3\Lib\site-packages\apptools\preferences\preferences.py:358, in Preferences.load(self, file_or_filename)
353 logger.debug("loading preferences from <%s>", file_or_filename)
355 # Do the import here so that we don't make 'ConfigObj' a requirement
356 # if preferences aren't ever persisted (or a derived class chooses to
357 # use a different persistence mechanism).
--> 358 from configobj import ConfigObj
360 config_obj = ConfigObj(file_or_filename, encoding="utf-8")
362 # 'name' is the section name, 'value' is a dictionary containing the
363 # name/value pairs in the section (the actual preferences ;^).

ModuleNotFoundError: No module named 'configobj'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions