hsahovic / poke-env

A python interface for training Reinforcement Learning bots to battle on pokemon showdown
https://poke-env.readthedocs.io/
MIT License
298 stars 105 forks source link

The environment must inherit from the gymnasium.Env class #482

Open i4D4 opened 10 months ago

i4D4 commented 10 months ago

After making several changes in order to get it to this point (turning ObservationType into ObsType), I encounter this error which I do not know how to fix.

C:\Users\i4D4\Downloads\poke-env-master\poke-env-master>C:\Users\i4D4\Downloads\poke-env-master\poke-env-master\AItest.py
2024-01-07 04:27:16.953831: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
WARNING:tensorflow:From C:\Users\i4D4\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

WARNING:tensorflow:From C:\Users\i4D4\AppData\Local\Programs\Python\Python310\lib\site-packages\rl\agents\ddpg.py:9: The name tf.disable_eager_execution is deprecated. Please use tf.compat.v1.disable_eager_execution instead.

Traceback (most recent call last):
  File "C:\Users\i4D4\Downloads\poke-env-master\poke-env-master\AItest.py", line 184, in <module>
    asyncio.get_event_loop().run_until_complete(main())
  File "C:\Users\i4D4\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Users\i4D4\Downloads\poke-env-master\poke-env-master\AItest.py", line 81, in main
    check_env(test_env)
  File "C:\Users\i4D4\AppData\Local\Programs\Python\Python310\lib\site-packages\gymnasium\utils\env_checker.py", line 276, in check_env
    assert isinstance(
AssertionError: The environment must inherit from the gymnasium.Env class. See https://gymnasium.farama.org/tutorials/gymnasium_basics/environment_creation/ for more info.
wogikaze commented 10 months ago

pip uninstall poke-env and pip install git+https://github.com/hsahovic/poke-env/ then it will fix them https://github.com/hsahovic/poke-env/commit/21755b520d582c1b7da01125f9f825fcbc8eb2c8 Looks like it hasn't been released since gym was replaced by gymnasium.

but I start getting strange error messages (WARNING:root:AAAHHHH) in accept_challenges.

i4D4 commented 10 months ago

That got rid of the problem, thank you! I will see how it goes from here.

zhaoyiheng2200476 commented 8 months ago

How can I solve the problem, is it solved by installing poke-env?