Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGSEGV on env.step for multiple renderings. #77

Closed
chasebos91 opened this issue Dec 4, 2019 · 8 comments
Closed

SIGSEGV on env.step for multiple renderings. #77

chasebos91 opened this issue Dec 4, 2019 · 8 comments
Assignees
Labels

Comments

@chasebos91
Copy link

Hey there,
I'm experiencing a segmentation fault after I call env.step when there are multiple renderings open. I saw a closed thread on openai for the same issue, but I'm unsure if the bug still persists across some of their environments.

@maximecb
Copy link
Contributor

maximecb commented Dec 4, 2019

Hi Chase. I think this is an issue related to the PyQT renderer. Can you provide a code snippet to reproduce the issue?

@chasebos91
Copy link
Author

Hey thanks for the quick response. Here's where I've instantiated multiple envs:

import gym
from gym_minigrid.wrappers import RGBImgObsWrapper
from PEARL import PEARL

env0 = RGBImgObsWrapper(gym.make("MiniGrid-Empty-Random-5x5-v0"))
env00 = RGBImgObsWrapper(gym.make("MiniGrid-FourRooms-v0"))
env1 = RGBImgObsWrapper(gym.make("MiniGrid-MultiRoom-N2-S4-v0"))
env2 = RGBImgObsWrapper(gym.make("MiniGrid-MultiRoom-N4-S5-v0"))
train_tasks = [env00, env0, env1, env2]
test_env = RGBImgObsWrapper(gym.make("MiniGrid-MultiRoom-N6-v0"))
test_tasks = [test_env]
#train
pearl = PEARL(train_tasks[0], train_tasks, test_tasks)
pearl.train_algo()

#########################################################################

And here's where I'm rendering each environment to initialize them into replay buffers:

def get_path(self, env, policy, max_length):
           ...
	s = env.reset()
	env.render()
	for i in range(max_length):
		a = policy.get_action(s)
		a = self.return_action(env, a)
		s_p, r, t, e_info = env.step(a)
                   ... # the line above breaks it

########################################################################

Thanks again for looking into it. I'll look up the issue in ref to PyQT in the meantime.

@maximecb
Copy link
Contributor

maximecb commented Dec 4, 2019

One temporary fix that could work is to run the environments in forked processes.

Otherwise though, next week I will start looking at implementing a renderer based on NumPy (see #76). I would ideally like to eliminate the PyQT dependency. You're not the only one to run into issues. If you're available to help me test next week that could he useful :)

@maximecb maximecb added the bug label Dec 4, 2019
@chasebos91
Copy link
Author

Hey, thanks that's awesome. I'd be happy to help, though I'm working on the implementation so it will definitely not be bug-free. If it's still helpful though, that would be great!

@maximecb
Copy link
Contributor

maximecb commented Dec 12, 2019

Hi @chasebos91. I have the new version of MiniGrid that uses NumPy to produce graphics on a new branch maximecb-numpy-render, and matplotlib for rendering windows. Could you test it out and let me know if it fixes the problem you encountered or if you run into any other issues?

@maximecb maximecb self-assigned this Dec 12, 2019
@chasebos91
Copy link
Author

chasebos91 commented Dec 13, 2019

So far so good! Will let you know as I keep working on it. Thank you!!
** EDIT: Sorry nvm I'm a GitHub noob, can you tell me how I can access the branch?

@maximecb
Copy link
Contributor

You can access it by first doing a git pull, then:

git checkout maximecb-numpy-render`

Then to install the package in editable mode:

pip3 install -e .

@maximecb
Copy link
Contributor

This is now pushed to the master branch as well :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants