-
Hello, whenever I set up from mesa.visualization import SolaraViz, make_space_component, make_plot_component
model_params= {
"width": {
"type": "SliderInt",
"value": 50,
"label": "Width",
"min": 5,
"max": 60,
"step": 1,
},
"height": {
"type": "SliderInt",
"value": 50,
"label": "Height",
"min": 5,
"max": 60,
"step": 1,
},
"num_vehicles": {
"type": "SliderInt",
"value": 10,
"label": "Number of vehicles:",
"min": 1,
"max": 20,
"step": 1,
},
"num_pedestrians": {
"type": "SliderInt",
"value": 10,
"label": "Number of pedestrians:",
"min": 1,
"max": 20,
"step": 1,
}
}
traffic_model = PedestrianBicycleModel(width=10, height=10, num_bicycles=10, num_vehicles=10)
SpaceGraph = make_space_component(Pedestrian.agent_portrayal)
# Visualization setup
page = SolaraViz(
traffic_model,
components = [SpaceGraph],
model_params=model_params,
name = "Please work"
)
page Thank you for the edits and patience. I checked that the model itself matches up with all of these parameters. After I run the file using solara, a browser opens running a localhost, and I get the following error message Traceback (most recent call last):
File "c:\Users\SmotP\Documents\COGS199\.venv\Lib\site-packages\reacton\core.py", line 1900, in _reconsolidate
effect()
~~~~~~^^
File "c:\Users\SmotP\Documents\COGS199\.venv\Lib\site-packages\reacton\core.py", line 1131, in __call__
self._cleanup = self.callable()
~~~~~~~~~~~~~^^
File "c:\Users\SmotP\Documents\COGS199\.venv\Lib\site-packages\mesa\visualization\solara_viz.py", line 423, in <lambda>
lambda: _check_model_params(model.value.__class__.__init__, fixed_params),
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\SmotP\Documents\COGS199\.venv\Lib\site-packages\mesa\visualization\solara_viz.py", line 476, in _check_model_params
raise ValueError(f"Missing required model parameter: {name}")
ValueError: Missing required model parameter: width ps: edited by @quaquel to make code clearer by using github markdown |
Beta Was this translation helpful? Give feedback.
Answered by
quaquel
Feb 10, 2025
Replies: 1 comment 5 replies
-
Hey @JJC022 can you show a minimal working example that reproduces this error. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are using arguments rather than keyword arguments. This most likely explains the problem. You also don't include
seed
, which is a bad idea because it makes your model not reproducible. Please change it to the signature below and let us know if that solves the problem.