mesa-examples icon indicating copy to clipboard operation
mesa-examples copied to clipboard

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

Open Harshini2411 opened this issue 8 months ago • 2 comments

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.

Harshini2411 avatar Mar 05 '26 14:03 Harshini2411

Hi, I'd like to work on this issue. Can I be assigned?

@quaquel

  1. What should replace BarChartModule and PieChartModule in Mesa 3.x? Should they be removed or reimplemented?
  2. Does Mesa 3.x support hex grid visualization? Also does it support arrowHead shape portrayal?

Harshini2411 avatar Mar 05 '26 14:03 Harshini2411

I can confirm this on Mesa 3.5.0, Python 3.13, Ubuntu. I am currently doing a broader audit of all examples — tracking issue coming soon. I can take a fix PR for one of these if no one is working on it yet.

annapurna-gupta avatar Mar 08 '26 15:03 annapurna-gupta