Skip to content

[Question] AsyncVectorEnv getting hung up as pip.recv() not returning anything for _check_observation_spaces #3273

@LeoHink

Description

@LeoHink

I'm having an issue initializing an AsyncVectorEnv for a custom environment which uses pybullet. I should specify that I am using gym==0.15.3 as this is the only compatible one for the environment I'm using.

I am using the following make_env function:

def make_env(env_id, idx, capture_video, seed):
    def thunk():
        if capture_video and idx == 0:
            env = gym.make(env_id)
            env.setup_camera(camera_eye=[0.5, -0.75, 1.5], camera_target=[-0.2, 0, 0.75], fov=60, camera_width=1920//4, camera_height=1080//4)
            # env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
            env.seed(seed)
        else:
            env = gym.make(env_id)
        env.seed(seed)
        env.action_space.seed(seed)
        env.observation_space.seed(seed)    

        return env
    
    return thunk

And envs = AsyncVectorEnv([make_env(env_id, i, False, seed) for i in range(num_envs)])

I've added some print statements to narrow down where the code is hanging. It seems to be in the def _check_observation_spaces(self): which is in line 307 in async_vector_env.py. Specifically after the loop:

        for pipe in self.parent_pipes:
            print(f"pipe: {pipe} /n parent pipes: {self.parent_pipes}")
            pipe.send(('_check_observation_space', self.single_observation_space))

This does seem to send the message but I do not receive anything when same_spaces, successes = zip(*[pipe.recv() for pipe in self.parent_pipes]) is called.

The code works fine when testing with cartpole, so it might be something to do with my environment and pybullet. Nonetheless wanted to post this here incase anyone is able to help. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions