Skip to content

Unable to run example: No module named 'mrml' and cannot import name 'vtkMRMLScene' from 'slicer' #57

@ddutartr

Description

@ddutartr

Hi,

I followed the installation steps described in the repository,, including installing the vtk_mrml wheel as indicated in the README, but I cannot run the example application (medical_viewer_app.py).

I successfully installed the Windows wheel (vtk_mrml-9.4.0-cp310-cp310-win_amd64.whl).
However, when I run the example application (medical_viewer_app.py) from a clean Python environment, I still get the following errors:

(trame) PS C:\Users\t6dutdan\Documents\dev\trame_slicer_proxy\examples> python .\medical_viewer_app.py
No module named 'mrml'
Traceback (most recent call last):
  File "C:\Users\t6dutdan\Documents\dev\trame_slicer_proxy\examples\medical_viewer_app.py", line 6, in <module>
    from viewer_lib import MedicalViewerLogic, MedicalViewerUI
  File "C:\Users\t6dutdan\Documents\dev\trame_slicer_proxy\examples\viewer_lib\__init__.py", line 1, in <module>
    from .logic import MedicalViewerLogic, SegmentationAppLogic
  File "C:\Users\t6dutdan\Documents\dev\trame_slicer_proxy\examples\viewer_lib\logic\__init__.py", line 1, in <module>
    from .base_logic import BaseLogic
  File "C:\Users\t6dutdan\Documents\dev\trame_slicer_proxy\examples\viewer_lib\logic\base_logic.py", line 3, in <module>
    from slicer import vtkMRMLScene
ImportError: cannot import name 'vtkMRMLScene' from 'slicer' (C:\Users\t6dutdan\AppData\Local\miniconda3\envs\trame\lib\site-packages\slicer\__init__.py)

It looks like the example still expects the full Slicer Python environment (with MRML and vtkMRMLScene), even though the README suggests that installing vtk_mrml should be enough.

Questions

Is the example expected to work in a standalone Python environment using only the vtk_mrml wheel?

If not, should the README clarify that a full 3D Slicer installation and the SlicerPython interpreter are required?

If yes, is there an additional step or dependency missing to expose vtkMRMLScene and MRML nodes from vtk_mrml?

Thanks for your help!

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