cannot import name 'BinarySpaceToDiscreteSpaceEnv' Solve



When you program using gym-super-mario-bros, you can see this error.

Traceback (most recent call last):
  File "", line 10, in <module>
    from nes_py.wrappers import BinarySpaceToDiscreteSpaceEnv
ImportError: cannot import name 'BinarySpaceToDiscreteSpaceEnv' from 'nes_py.wrappers' (C:\Users\Anaconda3\lib\site-packages\nes_py\wrappers\


Maybe, because of version changed, You have to use JoypadSpace, not BinarySpaceToDiscreteSpaceEnv. There is a solution. You have to change from BinarySpaceToDiscreteSpaceEnv to JoypadSpace. Like below example.

from nes_py.wrappers import JoypadSpace
env = JoypadSpace(env, [
    ['right', 'A'],
    ['left', 'A'],