jurgisp / memory-maze

Evaluating long-term memory of reinforcement learning algorithms
MIT License
129 stars 13 forks source link

Specify dependency version requirements #11

Closed zplizzi closed 1 year ago

zplizzi commented 1 year ago

Can you list the versions of required packages that you used or know work? When I try to run the GUI demo on mac python 3.9.2, I get this error, which I assume is because I have an incompatible version:

% python gui/run_gui.py

pygame 2.1.2 (SDL 2.0.18, Python 3.9.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
Creating environment: memory_maze:MemoryMaze-9x9-v0
Traceback (most recent call last):
  File "/Users/zplizzi/temp/memory-maze/gui/run_gui.py", line 228, in <module>
    main()
  File "/Users/zplizzi/temp/memory-maze/gui/run_gui.py", line 53, in main
    env = gym.make(args.env, disable_env_checker=True)
  File "/Users/zplizzi/.pyenv/versions/3.9.2/Python.framework/Versions/3.9/lib/python3.9/site-packages/gym/envs/registration.py", line 156, in make
    return registry.make(id, **kwargs)
  File "/Users/zplizzi/.pyenv/versions/3.9.2/Python.framework/Versions/3.9/lib/python3.9/site-packages/gym/envs/registration.py", line 101, in make
    env = spec.make(**kwargs)
  File "/Users/zplizzi/.pyenv/versions/3.9.2/Python.framework/Versions/3.9/lib/python3.9/site-packages/gym/envs/registration.py", line 70, in make
    env = self.entry_point(**_kwargs)
  File "/Users/zplizzi/.pyenv/versions/3.9.2/Python.framework/Versions/3.9/lib/python3.9/site-packages/memory_maze/__init__.py", line 23, in _make_gym_env
    dmenv = dm_task(**kwargs)
  File "/Users/zplizzi/.pyenv/versions/3.9.2/Python.framework/Versions/3.9/lib/python3.9/site-packages/memory_maze/tasks.py", line 25, in memory_maze_9x9
    return _memory_maze(9, 3, 250, **kwargs)
TypeError: _memory_maze() got an unexpected keyword argument 'disable_env_checker'
zplizzi commented 1 year ago

I updated gym and that error went away, but now I get this output and the pygame window is just a black screen with a spinny mouse cursor:

% python gui/run_gui.py                                                                                                                                                     130 ↵
Creating environment: memory_maze:MemoryMaze-9x9-v0
2023-01-13 13:24:30.868 Python[32096:4819747] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/k5/5485r0sj18vbkvttgzy37rkh0000gn/T/org.python.python.savedState
Observation space:  Box(0, 255, (64, 64, 3), uint8)
Action space:  Discrete(6)
WARNING:absl:Cannot set velocity on Entity with no free joint.
jurgisp commented 1 year ago

The dependencies are mentioned in the README:

# GUI dependencies
pip install gym pygame pillow imageio

But it seems you have figured that out already. I'm not sure what to make of the black frozen screen. The console logs don't indicate any problem, the WARNING is normal.

zplizzi commented 1 year ago

Yep it would be helpful if you specified the correct versions of those packages.

For some reason the code related to the fonts was causing the black screen issue - not sure why. I'm using pygame 2.1.2.

I changed the font-related lines to:

font = pygame.font.Font(None, 16)
fontsmall = pygame.font.Font(None, 12)

text_surface = font.render(line, True, (255, 255, 255))
screen.blit(text_surface, (16, y))
y += font.size(line)[1] + 2  # type: ignore

text_surface = fontsmall.render(line, True, (255, 255, 255))
screen.blit(text_surface, (render_size[0] + PANEL_LEFT + 16, y))
y += fontsmall.size(line)[1] + 2  # type: ignore

and it's working now.