BUG : MESA 2.3
AlABarazi opened this issue · comments
Hi,
I am getting this error when I run the code with mesa2.3. No problems with 2.1
`
/Users/alaaalbarazi/My Drive/Projects/Python_Projects/work/Skanska_last/ABM/agents/Entrance.py:8: FutureWarning: The Mesa Model class was not initialized. In the future, you need to explicitly initialize the Model by calling super().init() on initialization.
super().init(agent_name, model)
Traceback (most recent call last):
File "/Users/alaaalbarazi/Library/CloudStorage/GoogleDrive-alaabarazi@gmail.com/My Drive/Projects/Python_Projects/work/Skanska_last/run.py", line 3, in
from ABM.server import server
File "/Users/alaaalbarazi/My Drive/Projects/Python_Projects/work/Skanska_last/ABM/server.py", line 215, in
server = ModularServer(HRB, [text_element, canvas_element, chart_element],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alaaalbarazi/Library/Caches/pypoetry/virtualenvs/hrb-QVQNroNC-py3.11/lib/python3.11/site-packages/mesa_viz_tornado/ModularVisualization.py", line 354, in init
self.reset_model()
File "/Users/alaaalbarazi/Library/Caches/pypoetry/virtualenvs/hrb-QVQNroNC-py3.11/lib/python3.11/site-packages/mesa_viz_tornado/ModularVisualization.py", line 381, in reset_model
self.model = self.model_cls(**model_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alaaalbarazi/My Drive/Projects/Python_Projects/work/Skanska_last/ABM/model.py", line 438, in init
self.create_inital_building()
File "/Users/alaaalbarazi/My Drive/Projects/Python_Projects/work/Skanska_last/ABM/model.py", line 596, in create_inital_building
self.schedule.add(agent)
File "/Users/alaaalbarazi/My Drive/Projects/Python_Projects/work/Skanska_last/ABM/schedule.py", line 29, in add
self._agents[agent.unique_id] = agent
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: 'AgentSet' object does not support item assignment
`
Thanks for reporting a potential bug. Which exact Mesa version are you running? If not 2.3.2, could you update to it (with pip install --upgrade mesa
)?
FutureWarning: The Mesa Model class was not initialized. In the future, you need to explicitly initialize the Model by calling
super().__init__()
on initialization.
Do you understand this warning? If you do this, it might already solve your problem.
If that doesn’t help, could you post a minimal reproducible example?
Thanks for the answers. Yes I understand the warning . I will update the code. I am using 2.3.0 . Also 2.3.1 has the same issue.
I can post minimal reproducible code if nothing worked out.
The problem was caused because I have used a customized schedule instead of the one that come with MESA library. I have stoped working on this project for a year and forgot about this.
The problem has nothing to do with mesa 2.1 or 2.3.
Please delete the whole issue if possible.