Giter VIP home page Giter VIP logo

magent2's People

Contributors

benblack769 avatar bywbilly avatar delaschwein avatar dsctt avatar elliottower avatar git5001 avatar hominsu avatar jjshoots avatar jkterry1 avatar kipsora avatar kornbergfresnel avatar mariojayakumar avatar merrymercy avatar passionke avatar pseudo-rnd-thoughts avatar redtachyon avatar rodrigodelazcano avatar seawan avatar timerchen avatar wnzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

magent2's Issues

How to know if an agent is in another's attack range?

Hi there, I would like to know if there is an function to get the bool of if an agent is in another's attack_range, or to get all agents attackable.

If there is not, I know that attack range is set by CircleRange(radius).
Is the radius means the euclidean distance between two agents?

Is there any pre-trained model or scripted AI?

Hello!

I'm currently interested in cooperative MARL with a large number of agents and I think that MAgent2 is an amazing platform to prototype new ideas. Unfortunately, it seems that MAgent only supports competitive scenarios. Do you have any pre-trained model or scripted AI in specific environments such as battle or Combined arms? I want to use them as fixed opponents to bypass the need for self-playing.

Thank you!

Installation issues on Macos Python3.8

When running

pip install magent2

I get the result

Looking in indexes: https://mirrors.cloud.tencent.com/pypi/simple
Collecting magent2
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/ac/34/9e1951fbb296171aa67e544203ec3f88b1df0890e0ab848873b6c1c46852/magent2-0.3.2.tar.gz (4.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.1/4.1 MB 708.0 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
    Traceback (most recent call last):
      File "/Users/panhaoxuan/Desktop/project/29_magent/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
        main()
      File "/Users/panhaoxuan/Desktop/project/29_magent/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/Users/panhaoxuan/Desktop/project/29_magent/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
        return hook(config_settings)
      File "/private/var/folders/xy/l65yxphj301_00q2fwk8gnk00000gn/T/pip-build-env-4y33qhv_/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
        return self._get_build_requires(config_settings, requirements=['wheel'])
      File "/private/var/folders/xy/l65yxphj301_00q2fwk8gnk00000gn/T/pip-build-env-4y33qhv_/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
        self.run_setup()
      File "/private/var/folders/xy/l65yxphj301_00q2fwk8gnk00000gn/T/pip-build-env-4y33qhv_/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup
        exec(code, locals())
      File "<string>", line 116, in <module>
      File "<string>", line 21, in get_version
    FileNotFoundError: [Errno 2] No such file or directory: 'magent2/__init__.py'
    [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

TypeError: reset_wait() got an unexpected keyword argument 'seed'

Hi,

When I call the env.reset or reset_wait() from the vector_env.py I recieve the following error:

TypeError Traceback (most recent call last)
Cell In[2], line 113
110 best_test_reward = reward
111 torch.save(net.state_dict(), os.path.join(saves_path, "best_%.3f.dat" % reward))
--> 113 engine.run(common.batch_generator(buffer, PARAMS.replay_initial,
114 PARAMS.batch_size))

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:892, in Engine.run(self, data, max_epochs, epoch_length, seed)
889 self.state.dataloader = data
891 if self.interrupt_resume_enabled:
--> 892 return self._internal_run()
893 else:
894 return self._internal_run_legacy()

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:935, in Engine._internal_run(self)
933 self._internal_run_generator = self._internal_run_as_gen()
934 try:
--> 935 return next(self._internal_run_generator)
936 except StopIteration as out:
937 self._internal_run_generator = None

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:993, in Engine._internal_run_as_gen(self)
991 self._dataloader_iter = None
992 self.logger.error(f"Engine run is terminating due to exception: {e}")
--> 993 self._handle_exception(e)
995 self._dataloader_iter = None
996 return self.state

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:638, in Engine._handle_exception(self, e)
636 self._fire_event(Events.EXCEPTION_RAISED, e)
637 else:
--> 638 raise e

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:959, in Engine._internal_run_as_gen(self)
956 if self._dataloader_iter is None:
957 self._setup_engine()
--> 959 epoch_time_taken += yield from self._run_once_on_dataset_as_gen()
961 # time is available for handlers but must be updated after fire
962 self.state.times[Events.EPOCH_COMPLETED.name] = epoch_time_taken

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:1087, in Engine._run_once_on_dataset_as_gen(self)
1085 except Exception as e:
1086 self.logger.error(f"Current run is terminating due to exception: {e}")
-> 1087 self._handle_exception(e)
1089 return time.time() - start_time

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:638, in Engine._handle_exception(self, e)
636 self._fire_event(Events.EXCEPTION_RAISED, e)
637 else:
--> 638 raise e

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:1032, in Engine._run_once_on_dataset_as_gen(self)
1029 self._fire_event(Events.GET_BATCH_STARTED)
1030 yield from self._maybe_terminate_or_interrupt()
-> 1032 self.state.batch = next(self._dataloader_iter)
1033 self._fire_event(Events.GET_BATCH_COMPLETED)
1034 yield from self._maybe_terminate_or_interrupt()

File ~/MAgent2/lib/common.py:33, in batch_generator(buffer, initial, batch_size)
31 def batch_generator(buffer: experience.ExperienceReplayBuffer,
32 initial: int, batch_size: int):
---> 33 buffer.populate(initial)
34 while True:
35 buffer.populate(1)

File ~/MAgent2/ptan/ptan/experience.py:368, in ExperienceReplayBuffer.populate(self, samples)
363 """
364 Populates samples into the buffer
365 :param samples: how many samples to populate
366 """
367 for _ in range(samples):
--> 368 entry = next(self.experience_source_iter)
369 self._add(entry)

File ~/MAgent2/ptan/ptan/experience.py:176, in ExperienceSourceFirstLast.iter(self)
175 def iter(self):
--> 176 for exp in super(ExperienceSourceFirstLast, self).iter():
177 if exp[-1].done and len(exp) <= self.steps:
178 last_state = None

File ~/MAgent2/ptan/ptan/experience.py:53, in ExperienceSource.iter(self)
51 env_lens = []
52 for env in self.pool:
---> 53 obs = env.reset()
54 # if the environment is vectorized, all it's output is lists of results.
55 # Details are here: https://github.com/openai/universe/blob/master/doc/env_semantics.rst
56 if self.vectorized:

File ~/.local/lib/python3.8/site-packages/gym/vector/vector_env.py:108, in VectorEnv.reset(self, seed, options)
106 self.reset_async(seed=seed, options=options)
107 #self.reset_async()
**--> 108 return self.reset_wait(seed=seed, options=options)

TypeError: reset_wait() got an unexpected keyword argument 'seed'**

The issue is the arguments of the functions, particulary the seed. Is their a suggestion for a fix for this issue please? gym version 0.26 is installed.

Best wishes,

Essa

Installation issues on Linux

TypeError Traceback (most recent call last)
/tmp/ipykernel_30974/3606283676.py in
----> 1 from magent2.environments import battle_v4, adversarial_pursuit_v4, tiger_deer_v4
2 import sys, os
3 from pettingzoo.utils import random_demo
4 import pygame
5 import torch

~/miniconda3/envs/ai_env/lib/python3.7/site-packages/magent2/init.py in
----> 1 from magent2 import gridworld, utility
2 from magent2.render import Renderer
3
4 # some alias
5 GridWorld = gridworld.GridWorld

~/miniconda3/envs/ai_env/lib/python3.7/site-packages/magent2/gridworld.py in
119
120
--> 121 class Config:
122 """Configuration class for a Gridworld game."""
123

~/miniconda3/envs/ai_env/lib/python3.7/site-packages/magent2/gridworld.py in Config()
191 receiver: list[AgentSymbol],
...
--> 193 terminal: bool = False,
194 ):
195 """Add a reward rule.

TypeError: 'type' object is not subscriptable

env.reset()

from magent2.environments import battle_v4, adversarial_pursuit_v4, battlefield_v5, combined_arms_v6, gather_v5
from pettingzoo.utils import random_demo

env = battle_v4.env(map_size=16, minimap_mode=False, step_reward=-0.005,
dead_penalty=-0.1, attack_penalty=-0.1, attack_opponent_reward=0.2,
max_cycles=100000, extra_features=False, render_mode='human')
env.reset()
random_demo(env, render=True, episodes=1)

but got error:

File "/Users/qinmeng/PycharmProjects/MAHRL/test.py", line 20, in
env.reset()
File "/opt/homebrew/anaconda3/envs/tianshou/lib/python3.11/site-packages/pettingzoo/utils/wrappers/order_enforcing.py", line 118, in reset
super().reset(seed=seed, options=options)
File "/opt/homebrew/anaconda3/envs/tianshou/lib/python3.11/site-packages/pettingzoo/utils/wrappers/base.py", line 38, in reset
self.env.reset(seed=seed, options=options)
File "/opt/homebrew/anaconda3/envs/tianshou/lib/python3.11/site-packages/pettingzoo/utils/wrappers/base.py", line 38, in reset
self.env.reset(seed=seed, options=options)
File "/opt/homebrew/anaconda3/envs/tianshou/lib/python3.11/site-packages/pettingzoo/utils/conversions.py", line 306, in reset
self._observations, self.infos = self.env.reset(seed=seed, options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

Early Termination

Hello!

Is the combined arms scenario designed to terminate if all the agents of a certain "type" die? I am running a session where all the agents act randomly for 1000 cycles. Normally (not always), one of the two Armies will lose all their ranged agents. When this happens, the values for all the agents in the returned "termination" dictionary flip to true, essentially killing all the agents and ending the scenario. Is this by design?

Thanks!

env.reset() crashed in basic usage example

I installed magent2 with pip install magent2 and copy the missing .py files following this issue. Now I can import magent2 envs in python successfully. But when I tried to run the basic usage example as below. It just crashed.

$ python
Python 3.9.0 (default, Nov 15 2020, 14:28:56) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from magent2.environments import battle_v4
>>> env = battle_v4.env(map_size=16, render_mode='human')
>>> env.reset()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lhy/.conda/envs/dev/lib/python3.9/site-packages/pettingzoo/utils/wrappers/order_enforcing.py", line 101, in reset
    super().reset(seed=seed, options=options)
  File "/home/lhy/.conda/envs/dev/lib/python3.9/site-packages/pettingzoo/utils/wrappers/base.py", line 99, in reset
    self.env.reset(seed=seed, options=options)
  File "/home/lhy/.conda/envs/dev/lib/python3.9/site-packages/pettingzoo/utils/wrappers/base.py", line 99, in reset
    self.env.reset(seed=seed, options=options)
  File "/home/lhy/.conda/envs/dev/lib/python3.9/site-packages/pettingzoo/utils/conversions.py", line 284, in reset
    self._observations, self.infos = self.env.reset(seed=seed, options=options)
ValueError: too many values to unpack (expected 2)
>>> 

Related lib versions are listed below

$ python -c "import magent2; print(magent2.__version__)"
0.3.2
$ python -c "import pettingzoo; print(pettingzoo.__version__)"
1.23.1

ModuleNotFoundError: No module named 'magent2.environments'

I install the magent2 by command pip install magent2 and try to run the demon code. Yet it shows following error.

Traceback (most recent call last): File "****\test.py", line 1, in <module> from magent2.environments import battle_v4 ModuleNotFoundError: No module named 'magent2.environments'

Editable install and local install issues

Making an issue as I don't know how to fix this problem myself, seems something to do with the CMake files and C++ null pointer errors?

pip install -e .
Obtaining file:///Users/elliottower/Documents/GitHub/MAgent2
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.21.0 in /Users/elliottower/anaconda3/lib/python3.9/site-packages (from magent2==0.3.2) (1.23.5)
Requirement already satisfied: pygame>=2.1.0 in /Users/elliottower/anaconda3/lib/python3.9/site-packages (from magent2==0.3.2) (2.3.0)
Building wheels for collected packages: magent2
  Building editable for magent2 (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for magent2 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [176 lines of output]
      /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
        config = read_configuration(filepath, True, ignore_option_errors, dist)
      running editable_wheel
      creating /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2.egg-info
      writing /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2.egg-info/PKG-INFO
      writing dependency_links to /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2.egg-info/dependency_links.txt
      writing requirements to /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2.egg-info/requires.txt
      writing top-level names to /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2.egg-info/top_level.txt
      writing manifest file '/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2.egg-info/SOURCES.txt'
      reading manifest file '/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.dylib'
      warning: no files found matching '*.dll'
      warning: no files found matching '*.so'
      adding license file 'LICENSE'
      writing manifest file '/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2.egg-info/SOURCES.txt'
      creating '/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2-0.3.2.dist-info'
      creating /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-wheel-kz8_msv0/.tmp-cxeq7wjg/magent2-0.3.2.dist-info/WHEEL
      running build_py
      running build_ext
      -- The C compiler identification is AppleClang 13.1.6.13160021
      -- The CXX compiler identification is AppleClang 13.1.6.13160021
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Configuring done (1.4s)
      -- Generating done (0.0s)
      -- Build files have been written to: /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/tmpsqljm83r.build-temp
      /Users/elliottower/documents/github/magent2
      CMakeFiles
      CMakeLists.txt
      CODE_OF_CONDUCT.rst
      LICENSE
      MANIFEST.in
      MAgent2-text.png
      README.md
      build
      dist
      docs
      magent-graph-1.gif
      magent-graph-2.gif
      magent2
      magent2.egg-info
      pyproject.toml
      requirements.txt
      setup.py
      src
      [ 25%] Building CXX object CMakeFiles/magent.dir/src/gridworld/RenderGenerator.cc.o
      [ 25%] Building CXX object CMakeFiles/testlib.dir/src/gridworld/RenderGenerator.cc.o
      [ 30%] Building CXX object CMakeFiles/magent.dir/src/gridworld/test.cc.o
      [ 35%] Building CXX object CMakeFiles/testlib.dir/src/gridworld/Map.cc.o
      [ 40%] Building CXX object CMakeFiles/magent.dir/src/gridworld/AgentType.cc.o
      [ 40%] Building CXX object CMakeFiles/magent.dir/src/gridworld/GridWorld.cc.o
      [ 40%] Building CXX object CMakeFiles/magent.dir/src/gridworld/RewardEngine.cc.o
      [ 55%] Building CXX object CMakeFiles/magent.dir/src/gridworld/Map.cc.o
      [ 55%] Building CXX object CMakeFiles/testlib.dir/src/gridworld/AgentType.cc.o
      [ 60%] Building CXX object CMakeFiles/testlib.dir/src/gridworld/GridWorld.cc.o
      [ 60%] Building CXX object CMakeFiles/testlib.dir/src/gridworld/test.cc.o
      [ 60%] Building CXX object CMakeFiles/testlib.dir/src/gridworld/RewardEngine.cc.o
      [ 70%] Building CXX object CMakeFiles/testlib.dir/src/runtime_api.cc.o
      [ 70%] Building CXX object CMakeFiles/magent.dir/src/runtime_api.cc.o
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/Map.cc:180:9: warning: variable 'p_view_inner' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
              default:
              ^~~~~~~
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/Map.cc:184:24: note: uninitialized use occurs here
          int start_inner = *p_view_inner;
                             ^~~~~~~~~~~~
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/Map.cc:161:22: note: initialize the variable 'p_view_inner' to silence this warning
          int *p_view_inner, *p_view_outer;
                           ^
                            = nullptr
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/Map.cc:180:9: warning: variable 'p_view_inner' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
              default:
              ^~~~~~~
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/Map.cc:184:24: note: uninitialized use occurs here
          int start_inner = *p_view_inner;
                             ^~~~~~~~~~~~
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/Map.cc:161:22: note: initialize the variable 'p_view_inner' to silence this warning
          int *p_view_inner, *p_view_outer;
                           ^
                            = nullptr
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/RewardEngine.cc:366:9: warning: variable 'ret' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
              default:
              ^~~~~~~
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/RewardEngine.cc:370:12: note: uninitialized use occurs here
          return ret;
                 ^~~
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/RewardEngine.cc:217:13: note: initialize the variable 'ret' to silence this warning
          bool ret;
                  ^
                   = false
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/RewardEngine.cc:366:9: warning: variable 'ret' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
              default:
              ^~~~~~~
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/RewardEngine.cc:370:12: note: uninitialized use occurs here
          return ret;
                 ^~~
      /Users/elliottower/Documents/GitHub/MAgent2/src/gridworld/RewardEngine.cc:217:13: note: initialize the variable 'ret' to silence this warning
          bool ret;
                  ^
                   = false
      [ 75%] Building CXX object CMakeFiles/testlib.dir/src/temp_c_booster.cc.o
      [ 80%] Building CXX object CMakeFiles/magent.dir/src/temp_c_booster.cc.o
      [ 85%] Building CXX object CMakeFiles/magent.dir/src/utility/utility.cc.o
      [ 90%] Building CXX object CMakeFiles/testlib.dir/src/utility/utility.cc.o
      1 warning generated.
      1 warning generated.
      1 warning generated.
      1 warning generated.
      [ 95%] Linking CXX executable /var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/tmpq8nslohk.build-lib/magent2/testlib
      [100%] Linking CXX shared library /var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/tmpq8nslohk.build-lib/magent2/libmagent.dylib
      [100%] Built target testlib
      [100%] Built target magent
      Traceback (most recent call last):
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 155, in run
          self._create_wheel_file(bdist_wheel)
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 344, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 267, in _run_build_commands
          self._run_build_subcommands()
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 294, in _run_build_subcommands
          self.run_command(name)
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 87, in run
          self.copy_extensions_to_source()
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 108, in copy_extensions_to_source
          self.copy_file(regular_file, inplace_file, level=self.verbose)
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 350, in copy_file
          return file_util.copy_file(
        File "/private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/_distutils/file_util.py", line 115, in copy_file
          raise DistutilsFileError(
      distutils.errors.DistutilsFileError: can't copy '/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/tmpq8nslohk.build-lib/magent2/libmagent.cpython-39-darwin.so': doesn't exist or not a regular file
      /private/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/pip-build-env-48u8s0x5/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py:988: _DebuggingTips: Problem in editable installation.
      !!

              ********************************************************************************
              An error happened while installing `magent2` in editable mode.

              The following steps are recommended to help debug this problem:

              - Try to install the project normally, without using the editable mode.
                Does the error still persist?
                (If it does, try fixing the problem before attempting the editable mode).
              - If you are using binary extensions, make sure you have all OS-level
                dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
              - Try the latest version of setuptools (maybe the error was already fixed).
              - If you (or your project dependencies) are using any setuptools extension
                or customization, make sure they support the editable mode.

              After following the steps above, if the problem still persists and
              you think this is related to how setuptools handles editable installations,
              please submit a reproducible example
              (see https://stackoverflow.com/help/minimal-reproducible-example) to:

                  https://github.com/pypa/setuptools/issues

              See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
              ********************************************************************************

      !!
        cmd_obj.run()
      magent2.libmagent
      /var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/tmpq8nslohk.build-lib/magent2
      error: can't copy '/var/folders/5y/hjb1rykx58xcbwg6r04m76tr0000gn/T/tmpq8nslohk.build-lib/magent2/libmagent.cpython-39-darwin.so': doesn't exist or not a regular file
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for magent2
Failed to build magent2
ERROR: Could not build wheels for magent2, which is required to install pyproject.toml-based projects

This is with current master, which works for pip install . and can also build from source via python3 setup.py install (see #19). I tested out the commands in another issue and got some other errors which may or may not be related:

>>> from magent2.environments import battle_v4, adversarial_pursuit_v4, tiger_deer_v4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/elliottower/Documents/GitHub/MAgent2/magent2/__init__.py", line 1, in <module>
    from magent2 import gridworld, utility
  File "/Users/elliottower/Documents/GitHub/MAgent2/magent2/gridworld.py", line 10, in <module>
    from magent2.c_lib import _LIB, as_float_c_array, as_int32_c_array
  File "/Users/elliottower/Documents/GitHub/MAgent2/magent2/c_lib.py", line 43, in <module>
    _LIB = _load_lib()
  File "/Users/elliottower/Documents/GitHub/MAgent2/magent2/c_lib.py", line 22, in _load_lib
    lib = ctypes.CDLL(path_to_so_file, ctypes.RTLD_GLOBAL)
  File "/Users/elliottower/anaconda3/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/elliottower/Documents/GitHub/MAgent2/magent2/libmagent.dylib, 0x000A): tried: '/Users/elliottower/Documents/GitHub/MAgent2/magent2/libmagent.dylib' (no such file)

I ran cmake . as I saw it in the setup.py file, and that created a build directory which has the libmagent file. My guess is that I'm running the wrong command to install locally. Would be good to add to documentation how to build from source, how to build locally, etc (probably in a CONTRIBUTING.md file)

Render freeze when window lose focus.

from magent2.environments import battle_v4,adversarial_pursuit_v4 from pettingzoo.utils import random_demo env = adversarial_pursuit_v4.env(render_mode='human',max_cycles=200) random_demo(env, render=True, episodes=2)
For the code above, the render window will freeze when it loss focus.

The problem of tiger_deer_v4 scenario

Excuse me,have you experienced the following problem when functioning the scenario of tiger_deer_v4?
Problem:gridworld.py , line 515, in step
_LTB.env_step(self.game, ctypes.byref(done))
OSError:exception:access violation reading 0x00000147347E222C
Image_1706868406577

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.