Git Product home page Git Product logo

Comments (5)

DevPy129387 avatar DevPy129387 commented on August 26, 2024 1

Unfortunately I didn't try this fix. While waiting for a solution for this problem we decided to use another framework. Thanks for your advice.

from agentmet4fof.

BjoernLudwigPTB avatar BjoernLudwigPTB commented on August 26, 2024

Hi! Sorry for the delay. You seem to have customized the code somehow, as the file names and locations seem to differ from the default. Could you please share the content of Tutorial06_changeToMesa.py?

from agentmet4fof.

DevPy129387 avatar DevPy129387 commented on August 26, 2024

Hi!
I copied the code from https://agentmet4fof.readthedocs.io/en/latest/agentMET4FOF_tutorials/tutorial_6_mesa_backend.html into a *.py file and tried to run it.

# %load tutorial_6_mesa_backend.py
from agentMET4FOF.agents import AgentNetwork, MonitorAgent, SineGeneratorAgent
from agentMET4FOF.utils import Backend


def demonstrate_mesa_backend():

    # Start agent network and specify backend via the corresponding keyword parameter.
    _agent_network = AgentNetwork(backend=Backend.MESA)

    # Initialize agents by adding them to the agent network.
    sine_agent = _agent_network.add_agent(agentType=SineGeneratorAgent)
    monitor_agent = _agent_network.add_agent(agentType=MonitorAgent, buffer_size=200)
    sine_agent.bind_output(monitor_agent)

    # Set all agents states to "Running".
    _agent_network.set_running_state()

    return _agent_network


if __name__ == "__main__":
    demonstrate_mesa_backend()

I also tried to run the tutorial from the tutdorial-dir. I get the same output:

Traceback (most recent call last):
  File "D:\Anaconda\envs\Agents\Lib\site-packages\mesa\agent.py", line 53, in __init__
    self.model.agents_[type(self)][self] = None
    ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'agents_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Anaconda\envs\Agents\Lib\site-packages\agentMET4FOF_tutorials\tutorial_6_mesa_backend.py", line 22, in <module>
    demonstrate_mesa_backend()
  File "D:\Anaconda\envs\Agents\Lib\site-packages\agentMET4FOF_tutorials\tutorial_6_mesa_backend.py", line 8, in demonstrate_mesa_backend
    _agent_network = AgentNetwork(backend=Backend.MESA)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Anaconda\envs\Agents\Lib\site-packages\agentMET4FOF\network.py", line 597, in __init__
    self.start_server_mesa()
  File "D:\Anaconda\envs\Agents\Lib\site-packages\agentMET4FOF\network.py", line 688, in start_server_mesa
    self._controller = self._AgentController(
                       ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Anaconda\envs\Agents\Lib\site-packages\agentMET4FOF\agents\base_agents.py", line 63, in __init__
    MesaAgent.__init__(self, name, mesa_model)
  File "D:\Anaconda\envs\Agents\Lib\site-packages\mesa\agent.py", line 56, in __init__
    self.model.agents_ = defaultdict(dict)
    ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'agents_'

from agentmet4fof.

BjoernLudwigPTB avatar BjoernLudwigPTB commented on August 26, 2024

I am so sorry for the long delay. It seems that there arises some compatibility issue from a new release of mesa or some of the current versions of the dependencies. The error is reproducible in our CI environment since two months. I will look into this deeper in two weeks time about, but for now, you should be able ti fix your problem by following these steps:

  1. Inside of your Python environment (which hopefully is virtual environment exclusively for your agentMET4FOF project) install pip-tools:
    $ python -m pip install pip-tools
  2. Sync your dependencies with the pinned known to work versions from your repository's root folder:
    $ python -m piptools sync

This should clear all packages from the environment, which are not mentioned in our requirements.txt file and install otherwise all the packages mentioned in the respective versions.

Then please try again to run the tutorial. Everything should work as expected.

from agentmet4fof.

BjoernLudwigPTB avatar BjoernLudwigPTB commented on August 26, 2024

@DevPy129387 Were you able to try our fix?

from agentmet4fof.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.