Skip to content

Fix hex_snowflake, shape_example, charts: mesa.visualization no longer exists in Mesa 3.x #358

@Harshini2411

Description

@Harshini2411

Describe the bug

Three examples are broken because they use mesa.visualization which was removed in Mesa 3.x.

Affected examples:

  • hex_snowflake
  • shape_example
  • charts

To Reproduce

hex_snowflake:

  1. cd examples/hex_snowflake
  2. python run.py

shape_example:

  1. cd examples/shape_example
  2. python run.py

charts:

  1. cd examples/charts
  2. python run.py

Error

AttributeError: module 'mesa' has no attribute 'visualization'

Expected behavior

All three examples should run without errors.

Environment

  • Mesa version: 3.5.0
  • Python version: 3.x
  • OS: Windows

Possible fix

Migrate visualization from deprecated mesa.visualization (ModularServer, CanvasGrid, Slider) to the modern Solara-based approach using SolaraViz, make_space_component, and make_plot_component as used in other working examples in the repo.

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