zuoxingdong/mazelab

env.reset() doesn't work

YitzhakSp opened this issue · 6 comments

when running

from gym_maze.envs import MazeEnv
from gym_maze.envs.generators import *
maze = RandomBlockMazeGenerator(maze_size=4, obstacle_ratio=0.0)
env = MazeEnv(maze)
env.reset()

I get the following error:

Traceback (most recent call last):
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.  File "C:/Users/Yitzhak/Projects/gym-maze/example_1.py", line 5, in <module>
    env.reset()
  File "C:\Users\Yitzhak\Anaconda3\lib\site-packages\gym\core.py", line 71, in reset
    raise NotImplementedError
NotImplementedError

@YitzhakSp Thanks for the report. It seems the problem is related to new version of gym which requires dtype for Space objects. Now I have updated API, could you try again to see if it works now ? And by the way, maybe you also want to take a look at the required packages in README.

Thanks, now its working. However there is another problem now. did you try env.render() ? it opens a figure but the figure is empty and hangs up. here's the code I tried

from gym_maze.envs import MazeEnv
from gym_maze.envs.generators import *
import time

maze = RandomBlockMazeGenerator(maze_size=4, obstacle_ratio=0.0)
env = MazeEnv(maze)
env.reset()
for i in range(100):
    fig=env.render()
    action = env.action_space.sample()
    observation, reward, done, info = env.step(action)
    time.sleep(.5)

my system:
win10
python 3.6

@YitzhakSp I have tried again and it works fine. Do you use the following dependencies

- Numpy >= 1.14.2
- Matplotlib >= 2.1.2
- Scikit-image >= 0.13.1

yep, I have the required dependencies. maybe its a Windows problem.

@YitzhakSp If you have the up-to-date version of the dependencies, then I guess so the problem has something to do with Windows.

@YitzhakSp Hi, the repo is entirely rewritten now with much more modular design, can you re-check if it works now ?