openai / multi-agent-emergence-environments

Environment generation code for the paper "Emergent Tool Use From Multi-Agent Autocurricula"
MIT License
1.64k stars 307 forks source link

gym.error.DoubleWrapperError: Attempted to double wrap with Wrapper: AgentGeomObsMask2D #42

Closed Open-AGI closed 2 years ago

Open-AGI commented 2 years ago

I want it to support tf2, but I ran into some problems:

gym.error.DoubleWrapperError: Attempted to double wrap with Wrapper: AgentGeomObsMask2D

### Environment:

(env1) root@agi:/home/agi/Downloads/multi-agent-emergence-environments# uname -a

Linux agi 5.13.0-22-generic #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

(env1) root@agi:/home/agi/Downloads/multi-agent-emergence-environments#  conda list
# packages in environment at /root/anaconda3/envs/env1:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
_tflow_select             2.1.0                       gpu  
abseil-cpp                20210324.2           h9c3ff4c_0    conda-forge
absl-py                   1.0.0              pyhd8ed1ab_0    conda-forge
aiohttp                   3.8.1            py39h3811e60_0    conda-forge
aiosignal                 1.2.0              pyhd8ed1ab_0    conda-forge
alabaster                 0.7.12                     py_0    conda-forge
astor                     0.8.1              pyh9f0ad1d_0    conda-forge
astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
async-timeout             4.0.1              pyhd8ed1ab_0    conda-forge
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
babel                     2.9.1              pyh44b312d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
baselines                 0.1.6                     dev_0    <develop>
binutils_impl_linux-64    2.36.1               h193b22a_2    conda-forge
blinker                   1.4                        py_1    conda-forge
brotlipy                  0.7.0           py39h3811e60_1003    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2021.10.26           h06a4308_2  
cachetools                4.2.4              pyhd8ed1ab_0    conda-forge
certifi                   2021.10.8        py39h06a4308_0  
cffi                      1.15.0                   pypi_0    pypi
charset-normalizer        2.0.7              pyhd8ed1ab_0    conda-forge
click                     8.0.3            py39hf3d152e_1    conda-forge
cloudpickle               1.2.2                    pypi_0    pypi
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
cryptography              36.0.0           py39h95dcef6_0    conda-forge
cudatoolkit               11.3.1               h2bc3f7f_2  
cudnn                     8.2.1                cuda11.3_0  
cython                    0.29.24          py39he80948d_1    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
decorator                 5.1.0              pyhd8ed1ab_0    conda-forge
docutils                  0.17.1                   pypi_0    pypi
fasteners                 0.16.3                   pypi_0    pypi
freetype                  2.10.4               h0708190_1    conda-forge
frozenlist                1.2.0            py39h3811e60_1    conda-forge
future                    0.18.2                   pypi_0    pypi
gast                      0.3.3                      py_0    conda-forge
gcc                       11.2.0               h702ea55_1    conda-forge
gcc_impl_linux-64         11.2.0              h82a94d6_11    conda-forge
giflib                    5.2.1                h36c2ea0_2    conda-forge
glfw                      2.4.0                    pypi_0    pypi
google-auth               1.35.0             pyh6c4a22f_0    conda-forge
google-auth-oauthlib      0.4.6              pyhd8ed1ab_0    conda-forge
google-pasta              0.2.0              pyh8c360ce_0    conda-forge
grpc-cpp                  1.37.1               hfc4d69e_3    conda-forge
grpcio                    1.37.1           py39hff7568b_0    conda-forge
gym                       0.10.5                   pypi_0    pypi
h5py                      2.10.0          nompi_py39h98ba4bc_106    conda-forge
hdf5                      1.10.6          nompi_h6a2412b_1114    conda-forge
icu                       68.2                 h9c3ff4c_0    conda-forge
idna                      3.3                      pypi_0    pypi
imagehash                 4.2.1              pyhd8ed1ab_0    conda-forge
imageio                   2.11.1                   pypi_0    pypi
imagesize                 1.3.0              pyhd8ed1ab_0    conda-forge
importlib-metadata        4.8.2            py39hf3d152e_0    conda-forge
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
ipdb                      0.13.9             pyhd8ed1ab_0    conda-forge
ipython                   7.29.0           py39hef51801_2    conda-forge
jbig                      2.1               h7f98852_2003    conda-forge
jedi                      0.18.1           py39hf3d152e_0    conda-forge
jinja2                    3.0.3              pyhd8ed1ab_0    conda-forge
joblib                    1.1.0                    pypi_0    pypi
jpeg                      9d                   h36c2ea0_0    conda-forge
jsonnet                   0.17.0                   pypi_0    pypi
keras                     2.7.0                    pypi_0    pypi
keras-preprocessing       1.1.2              pyhd8ed1ab_0    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge
krb5                      1.19.2               hcc1bbae_3    conda-forge
lcms2                     2.12                 hddcbb42_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
lerc                      2.2.1                h9c3ff4c_0    conda-forge
libblas                   3.9.0           12_linux64_openblas    conda-forge
libcblas                  3.9.0           12_linux64_openblas    conda-forge
libclang                  12.0.0                   pypi_0    pypi
libcurl                   7.79.1               h2574ce0_1    conda-forge
libdeflate                1.7                  h7f98852_5    conda-forge
libedit                   3.1.20210910         h7f8727e_0  
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.3                  he6710b0_2  
libgcc-devel_linux-64     11.2.0              h0952999_11    conda-forge
libgcc-ng                 11.2.0              h1d223b6_11    conda-forge
libgfortran-ng            11.2.0              h69a702a_11    conda-forge
libgfortran5              11.2.0              h5c6108e_11    conda-forge
libgomp                   11.2.0              h1d223b6_11    conda-forge
liblapack                 3.9.0           12_linux64_openblas    conda-forge
libnghttp2                1.43.0               h812cca2_1    conda-forge
libopenblas               0.3.18          pthreads_h8fe5266_0    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libprotobuf               3.15.8               h780b84a_1    conda-forge
libsanitizer              11.2.0              he4da1e4_11    conda-forge
libssh2                   1.10.0               ha56f1ee_2    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_11    conda-forge
libtiff                   4.3.0                hf544144_1    conda-forge
libwebp-base              1.2.1                h7f98852_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
lockfile                  0.12.2                     py_1    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
markdown                  3.3.6              pyhd8ed1ab_0    conda-forge
markupsafe                2.0.1            py39h3811e60_1    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
monotonic                 1.5                        py_0    conda-forge
more-itertools            8.12.0             pyhd8ed1ab_0    conda-forge
mujoco-py                 2.0.2.13                  dev_0    <develop>
mujoco-worldgen           0.0.0                     dev_0    <develop>
multidict                 5.2.0            py39h3811e60_1    conda-forge
ncurses                   6.3                  h7f8727e_2  
numpy                     1.21.0                   pypi_0    pypi
numpy-stl                 2.16.3                   pypi_0    pypi
oauthlib                  3.1.1              pyhd8ed1ab_0    conda-forge
olefile                   0.46               pyh9f0ad1d_1    conda-forge
opencv-python             4.5.4.60                 pypi_0    pypi
openssl                   1.1.1l               h7f8727e_0  
opt_einsum                3.3.0              pyhd8ed1ab_1    conda-forge
p5py                      1.0.0                    pypi_0    pypi
packaging                 21.3               pyhd8ed1ab_0    conda-forge
parso                     0.8.2              pyhd8ed1ab_0    conda-forge
pep517                    0.12.0                   pypi_0    pypi
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    8.4.0                    pypi_0    pypi
pip                       21.3.1                   pypi_0    pypi
pluggy                    1.0.0            py39hf3d152e_2    conda-forge
prompt-toolkit            3.0.22             pyha770c72_0    conda-forge
protobuf                  3.15.8           py39he80948d_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
py                        1.11.0             pyh6c4a22f_0    conda-forge
pyasn1                    0.4.8                      py_0    conda-forge
pyasn1-modules            0.2.7                      py_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyglet                    1.5.0                    pypi_0    pypi
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pyjwt                     2.0.1              pyhd8ed1ab_0    conda-forge
pyopenssl                 21.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.6              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1            py39hf3d152e_4    conda-forge
pytest                    6.2.5                    pypi_0    pypi
pytest-instafail          0.4.2                    pypi_0    pypi
python                    3.9.7                h12debd9_1  
python-flatbuffers        1.12               pyhd8ed1ab_1    conda-forge
python-utils              2.5.6                    pypi_0    pypi
python_abi                3.9                      2_cp39    conda-forge
pytz                      2021.3             pyhd8ed1ab_0    conda-forge
pyu2f                     0.1.5              pyhd8ed1ab_0    conda-forge
pywavelets                1.2.0            py39hce5d2b2_0    conda-forge
re2                       2021.08.01           h9c3ff4c_0    conda-forge
readline                  8.1                  h27cfd23_0  
requests                  2.26.0             pyhd8ed1ab_1    conda-forge
requests-oauthlib         1.3.0              pyh9f0ad1d_0    conda-forge
rsa                       4.8                pyhd8ed1ab_0    conda-forge
scipy                     1.7.2                    pypi_0    pypi
setuptools                59.4.0                   pypi_0    pypi
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.8                he1b5a44_3    conda-forge
snowballstemmer           2.2.0              pyhd8ed1ab_0    conda-forge
sphinx                    4.3.0              pyh6c4a22f_0    conda-forge
sphinx_rtd_theme          1.0.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    2.0.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.5              pyhd8ed1ab_1    conda-forge
sqlite                    3.36.0               hc218d9a_0  
sysroot_linux-64          2.12                he073ed8_15    conda-forge
tensorboard               2.7.0                    pypi_0    pypi
tensorboard-data-server   0.6.1                    pypi_0    pypi
tensorboard-plugin-wit    1.8.0              pyh44b312d_0    conda-forge
tensorflow                2.4.1            py39hf3d152e_0    conda-forge
tensorflow-base           2.4.1            py39h23a8cbf_0    conda-forge
tensorflow-estimator      2.7.0                    pypi_0    pypi
tensorflow-gpu            2.7.0                    pypi_0    pypi
tensorflow-io-gcs-filesystem 0.22.0                   pypi_0    pypi
termcolor                 1.1.0                      py_2    conda-forge
tk                        8.6.11               h1ccaba5_0  
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     1.2.2                    pypi_0    pypi
tqdm                      4.62.3                   pypi_0    pypi
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
typing-extensions         4.0.0                hd8ed1ab_0    conda-forge
typing_extensions         4.0.0              pyha770c72_0    conda-forge
tzdata                    2021e                hda174b7_0  
urllib3                   1.26.7             pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
werkzeug                  2.0.1              pyhd8ed1ab_0    conda-forge
wheel                     0.37.0             pyhd3eb1b0_1  
wrapt                     1.13.3           py39h3811e60_1    conda-forge
xmltodict                 0.12.0                   pypi_0    pypi
xorg-fixesproto           5.0               h7f98852_1002    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libx11               1.7.2                h7f98852_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxcursor           1.2.0                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-libxfixes            5.0.3             h7f98852_1004    conda-forge
xorg-libxinerama          1.1.4             h9c3ff4c_1001    conda-forge
xorg-libxrandr            1.5.2                h7f98852_1    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-randrproto           1.5.0             h7f98852_1001    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.5                h7b6447c_0  
yarl                      1.7.2            py39h3811e60_1    conda-forge
zipp                      3.6.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11               h7b6447c_3  
zstd                      1.5.0                ha95c52a_0    conda-forge
(env1) root@agi:/home/agi/Downloads/multi-agent-emergence-environments# pip3 list
Package                       Version   Location
----------------------------- --------- ----------------------------------------------------------------------------------
absl-py                       1.0.0
aiohttp                       3.8.1
aiosignal                     1.2.0
alabaster                     0.7.12
astor                         0.8.1
astunparse                    1.6.3
async-timeout                 4.0.1
attrs                         21.2.0
Babel                         2.9.1
backcall                      0.2.0
backports.functools-lru-cache 1.6.4
baselines                     0.1.6     /home/agi/Downloads/baselines
blinker                       1.4
brotlipy                      0.7.0
cachetools                    4.2.4
certifi                       2021.10.8
cffi                          1.15.0
charset-normalizer            2.0.7
click                         8.0.3
cloudpickle                   1.2.2
colorama                      0.4.4
cryptography                  36.0.0
Cython                        0.29.24
dataclasses                   0.8
decorator                     5.1.0
docutils                      0.17.1
fasteners                     0.16.3
flatbuffers                   1.12
frozenlist                    1.2.0
future                        0.18.2
gast                          0.3.3
glfw                          2.4.0
google-auth                   1.35.0
google-auth-oauthlib          0.4.6
google-pasta                  0.2.0
grpcio                        1.37.1
gym                           0.10.5
h5py                          2.10.0
idna                          3.3
ImageHash                     4.2.1
imageio                       2.11.1
imagesize                     1.3.0
importlib-metadata            4.8.2
iniconfig                     1.1.1
ipdb                          0.13.9
ipython                       7.29.0
jedi                          0.18.1
Jinja2                        3.0.3
joblib                        1.1.0
jsonnet                       0.17.0
keras                         2.7.0
Keras-Preprocessing           1.1.2
libclang                      12.0.0
lockfile                      0.12.2
Markdown                      3.3.6
MarkupSafe                    2.0.1
matplotlib-inline             0.1.3
monotonic                     1.5
more-itertools                8.12.0
mujoco-py                     2.0.2.13  /root/anaconda3/envs/env1/lib/python3.9/site-packages/mujoco_py-2.0.2.13-py3.9.egg
mujoco-worldgen               0.0.0     /home/agi/Downloads/mujoco-worldgen
multidict                     5.2.0
numpy                         1.21.4
numpy-stl                     2.16.3
oauthlib                      3.1.1
olefile                       0.46
opencv-python                 4.5.4.60
opt-einsum                    3.3.0
p5py                          1.0.0
packaging                     21.3
parso                         0.8.2
pep517                        0.12.0
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        8.4.0
pip                           21.3.1
pluggy                        1.0.0
prompt-toolkit                3.0.22
protobuf                      3.15.8
ptyprocess                    0.7.0
py                            1.11.0
pyasn1                        0.4.8
pyasn1-modules                0.2.7
pycparser                     2.21
pyglet                        1.5.0
Pygments                      2.10.0
PyJWT                         2.0.1
pyOpenSSL                     21.0.0
pyparsing                     3.0.6
PySocks                       1.7.1
pytest                        6.2.5
pytest-instafail              0.4.2
python-utils                  2.5.6
pytz                          2021.3
pyu2f                         0.1.5
PyWavelets                    1.2.0
requests                      2.26.0
requests-oauthlib             1.3.0
rsa                           4.8
scipy                         1.7.3
setuptools                    59.4.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        4.3.0
sphinx-rtd-theme              1.0.0
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
tensorboard                   2.7.0
tensorboard-data-server       0.6.1
tensorboard-plugin-wit        1.8.0
tensorflow                    2.4.1
tensorflow-estimator          2.7.0
tensorflow-gpu                2.7.0
tensorflow-io-gcs-filesystem  0.22.0
termcolor                     1.1.0
toml                          0.10.2
tomli                         1.2.2
tqdm                          4.62.3
traitlets                     5.1.1
typing_extensions             4.0.0
urllib3                       1.26.7
wcwidth                       0.2.5
Werkzeug                      2.0.1
wheel                         0.37.0
wrapt                         1.13.3
xmltodict                     0.12.0
yarl                          1.7.2
zipp                          3.6.0
Open-AGI commented 2 years ago

python examples/body_interaction.py

I tested the py files in the examples/ of mujoco-py and they all worked normally.

but,I try run (env1) root@agi:/home/agi/Downloads/multi-agent-emergence-environments# bin/examine.py examples/hide_and_seek_quadrant.jsonnet examples/hide_and_seek_quadrant.npz

i get some err:


(env1) root@agi:/home/agi/Downloads/multi-agent-emergence-environments# bin/examine.py examples/hide_and_seek_quadrant.jsonnet examples/hide_and_seek_quadrant.npz

Inferred:
    names: examples/hide_and_seek_quadrant.jsonnet examples/hide_and_seek_quadrant.npz
    arguments: {}

Traceback (most recent call last):
  File "/home/agi/Downloads/multi-agent-emergence-environments/bin/examine.py", line 91, in <module>
    main()
  File "/root/anaconda3/envs/env1/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/root/anaconda3/envs/env1/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/root/anaconda3/envs/env1/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/anaconda3/envs/env1/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/agi/Downloads/multi-agent-emergence-environments/bin/examine.py", line 56, in main
    env, args_remaining_env = load_env(env_name, core_dir=core_dir,
  File "/home/agi/Downloads/mujoco-worldgen/mujoco_worldgen/util/envs/flexible_load.py", line 84, in load_env
    env = make_env(**args_to_pass)
  File "/home/agi/Downloads/mujoco-worldgen/mujoco_worldgen/util/envs/flexible_load.py", line 27, in result_wrapper
    return result(*args, **actual_kwargs)
  File "/home/agi/Downloads/multi-agent-emergence-environments/mae_envs/envs/hide_and_seek.py", line 390, in make_env
    env = AgentGeomObsMask2D(env, pos_obs_key='ramp_pos', mask_obs_key='mask_ar_obs',
  File "/home/agi/Downloads/multi-agent-emergence-environments/mae_envs/wrappers/line_of_sight.py", line 75, in __init__
    super().__init__(env)
  File "/root/anaconda3/envs/env1/lib/python3.9/site-packages/gym/core.py", line 247, in __init__
    self._warn_double_wrap()
  File "/root/anaconda3/envs/env1/lib/python3.9/site-packages/gym/core.py", line 258, in _warn_double_wrap
    raise error.DoubleWrapperError("Attempted to double wrap with Wrapper: {}".format(self.__class__.__name__))
gym.error.DoubleWrapperError: Attempted to double wrap with Wrapper: AgentGeomObsMask2D
pythlang commented 2 years ago

Not sure about the tf implementation, but one of my gym packages somehow updated and got a different error (and then I reverted to gym==0.10.5 which gave me your error and that's the gym version you're using) which I then solved by reverting to gym==0.10.8.