Cognitive-AI-Systems/pogema

Gym do not see pogema env.

Closed this issue · 2 comments

Consider the code i took from https://pypi.org/project/pogema/1.0.1/

import gym
from pogema import GridConfig

# Define random configuration
grid_config = GridConfig(num_agents=4,  # number of agents
                         size=8, # size of the grid
                         density=0.4,  # obstacle density
                         seed=1,  # set to None for random 
                                  # obstacles, agents and targets 
                                  # positions at each reset
                         max_episode_steps=128,  # horizon
                         obs_radius=3,  # defines field of view
                         )

env = gym.make('Pogema-v0', grid_config=grid_config)
env.reset()
env.render()

I got the error:

Traceback (most recent call last):

  Cell In[5], line 15
    env = gym.make('Pogema-v0', grid_config=grid_config)

  File ~\anaconda3\envs\rl_hw5\lib\site-packages\gym\envs\registration.py:569 in make
    _check_version_exists(ns, name, version)

  File ~\anaconda3\envs\rl_hw5\lib\site-packages\gym\envs\registration.py:219 in _check_version_exists
    _check_name_exists(ns, name)

  File ~\anaconda3\envs\rl_hw5\lib\site-packages\gym\envs\registration.py:197 in _check_name_exists
    raise error.NameNotFound(

NameNotFound: Environment Pogema doesn't exist. Did you mean: `Pong`?

My environment is defined below, also inform I install gym as pip install gym[atari,accept-rom-license]

packages in environment at C:\Users\satyr\anaconda3\envs\rl_hw5:

Name Version Build Channel

abseil-cpp 20211102.0 h0e60522_0 conda-forge
absl-py 2.1.0 pyhd8ed1ab_0 conda-forge
ale-py 0.8.1 pypi_0 pypi
asttokens 2.0.5 pyhd3eb1b0_0
autorom 0.4.2 pypi_0 pypi
autorom-accept-rom-license 0.6.1 pypi_0 pypi
box2d-py 2.3.5 pypi_0 pypi
bzip2 1.0.8 h2bbff1b_5
c-ares 1.19.1 h2bbff1b_0
ca-certificates 2024.2.2 h56e8100_0 conda-forge
certifi 2024.2.2 pypi_0 pypi
charset-normalizer 3.3.2 pypi_0 pypi
click 8.1.7 pypi_0 pypi
cloudpickle 2.2.1 py310haa95532_0
colorama 0.4.6 py310haa95532_0
comm 0.2.1 py310haa95532_0
contourpy 1.2.0 pypi_0 pypi
cycler 0.12.1 pypi_0 pypi
d3rlpy 2.4.0 pypi_0 pypi
dataclasses-json 0.6.4 pypi_0 pypi
debugpy 1.6.7 py310hd77b12b_0
decorator 5.1.1 pyhd3eb1b0_0
et-xmlfile 1.1.0 pypi_0 pypi
etils 1.7.0 pypi_0 pypi
exceptiongroup 1.2.0 py310haa95532_0
executing 0.8.3 pyhd3eb1b0_0
farama-notifications 0.0.4 pypi_0 pypi
filelock 3.13.3 pypi_0 pypi
fonttools 4.50.0 pypi_0 pypi
fsspec 2024.3.1 pypi_0 pypi
glfw 2.7.0 pypi_0 pypi
grpc-cpp 1.48.2 hfe90ff0_1
grpcio 1.62.1 pypi_0 pypi
gym 0.26.2 pypi_0 pypi
gym-notices 0.0.8 pypi_0 pypi
gymnasium 0.28.1 pypi_0 pypi

h5py 3.11.0 pypi_0 pypi
idna 3.6 pypi_0 pypi
imageio 2.34.0 pypi_0 pypi
importlib-metadata 7.1.0 pyha770c72_0 conda-forge
importlib-resources 6.4.0 pypi_0 pypi
intel-openmp 2024.0.0 h57928b3_49841 conda-forge
ipykernel 6.28.0 py310haa95532_0
ipython 8.20.0 py310haa95532_0
jax-jumpy 1.0.0 pypi_0 pypi
jedi 0.18.1 py310haa95532_1
jinja2 3.1.3 pypi_0 pypi
jupyter_client 8.6.0 py310haa95532_0
jupyter_core 5.5.0 py310haa95532_0
kiwisolver 1.4.5 pypi_0 pypi
libblas 3.9.0 8_mkl conda-forge
libcblas 3.9.0 8_mkl conda-forge
libffi 3.4.4 hd77b12b_0
liblapack 3.9.0 8_mkl conda-forge
libprotobuf 3.20.3 h23ce68f_0
libsodium 1.0.18 h62dcd97_0
markdown 3.6 pyhd8ed1ab_0 conda-forge
markdown-it-py 3.0.0 pypi_0 pypi
markupsafe 2.1.5 pypi_0 pypi
marshmallow 3.21.1 pypi_0 pypi
matplotlib 3.8.3 pypi_0 pypi
matplotlib-inline 0.1.6 py310haa95532_0
mdurl 0.1.2 pypi_0 pypi
mkl 2020.4 hb70f87d_311 conda-forge
mpmath 1.3.0 pypi_0 pypi
mujoco 2.3.7 pypi_0 pypi
mypy-extensions 1.0.0 pypi_0 pypi
nest-asyncio 1.6.0 py310haa95532_0
networkx 3.2.1 pypi_0 pypi
numpy 1.26.4 pypi_0 pypi
opencv-python 4.9.0.80 pypi_0 pypi
openpyxl 3.1.2 pypi_0 pypi
openssl 3.0.13 h2bbff1b_0
packaging 23.2 py310haa95532_0
pandas 2.2.1 pypi_0 pypi
parso 0.8.3 pyhd3eb1b0_0
pillow 10.2.0 pypi_0 pypi
pip 23.3.1 py310haa95532_0
platformdirs 3.10.0 py310haa95532_0
pogema 1.2.2 pypi_0 pypi
prompt-toolkit 3.0.43 py310haa95532_0
prompt_toolkit 3.0.43 hd3eb1b0_0
protobuf 5.26.1 pypi_0 pypi
psutil 5.9.0 py310h2bbff1b_0
pure_eval 0.2.2 pyhd3eb1b0_0
pydantic 1.9.1 pypi_0 pypi
pygame 2.1.0 pypi_0 pypi
pygments 2.15.1 py310haa95532_1
pyopengl 3.1.7 pypi_0 pypi
pyparsing 3.1.2 pypi_0 pypi
python 3.10.14 he1021f5_0
python-dateutil 2.8.2 pyhd3eb1b0_0
python_abi 3.10 2_cp310 conda-forge
pytz 2024.1 pypi_0 pypi
pywin32 305 py310h2bbff1b_0
pyzmq 25.1.2 py310hd77b12b_0
re2 2022.04.01 h0e60522_0 conda-forge
requests 2.31.0 pypi_0 pypi
rich 13.7.1 pypi_0 pypi
seaborn 0.13.2 pypi_0 pypi
setuptools 68.2.2 py310haa95532_0
shimmy 1.3.0 pypi_0 pypi
six 1.16.0 pyhd3eb1b0_1
spyder-kernels 2.4.4 py310haa95532_0
sqlite 3.41.2 h2bbff1b_0
stable-baselines3 2.3.0 pypi_0 pypi
stack_data 0.2.0 pyhd3eb1b0_0
structlog 24.1.0 pypi_0 pypi
swig 4.2.1 pypi_0 pypi
sympy 1.12 pypi_0 pypi
tabulate 0.9.0 pypi_0 pypi
tensorboard 2.16.2 pyhd8ed1ab_0 conda-forge
tensorboard-data-server 0.7.2 pypi_0 pypi
tk 8.6.12 h2bbff1b_0
torch 2.2.2 pypi_0 pypi
tornado 6.3.3 py310h2bbff1b_0
tqdm 4.66.2 pypi_0 pypi
traitlets 5.7.1 py310haa95532_0
typing-extensions 4.10.0 pypi_0 pypi
typing-inspect 0.9.0 pypi_0 pypi
tzdata 2024.1 pypi_0 pypi
urllib3 2.2.1 pypi_0 pypi
vc 14.2 h21ff451_1
vs2015_runtime 14.27.29016 h5e58377_2
wcwidth 0.2.5 pyhd3eb1b0_0
werkzeug 3.0.1 pyhd8ed1ab_0 conda-forge
wheel 0.41.2 py310haa95532_0
xz 5.4.6 h8cc25b3_0
zeromq 4.3.5 hd77b12b_0
zipp 3.18.1 pypi_0 pypi
zlib 1.2.13 h8cc25b3_0

It seems like you are trying to run an example from version pogema 1.0.1, but you have installed pogema 1.2.2. Note that version 1.2.2 does not use "gym"; instead, it uses the "gymnasium" library.

You can downgrade pogema to version 1.0.1 using the following command:

pip install pogema==1.0.1

However, I suggest using the latest version along with the gymnsium framework. Here is an example with the latest version of pogema:

from pogema import pogema_v0, Hard8x8

env = pogema_v0(grid_config=Hard8x8())

obs, info = env.reset()

while True:
    # Using a random policy to make actions
    obs, reward, terminated, truncated, info = env.step(env.sample_actions())
    env.render()
    if any(terminated) or any(truncated):
        break

I believe the problem has been resolved; therefore, I am closing the issue.