Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

MuJoCo error when deployed inside launchpad #35

@Akella17

Description

@Akella17

Context: I have MuJoCo physics simulator setup on my machine and works fine for my RL experiments. However, when I launch multiple instances of the MuJoCo environment inside launchpad nodes, I get the following error:

ERROR: GLEW initialization error: Missing GL version
Press Enter to exit ...

This error happens only when I launch multiple environments on different launchpad nodes or one environment outside the launchpad and one inside a launchpad node (refer to the example below). This error does not occur when I do not use launchpad.

Here's a minimal code to reproduce this on my machine:

import gym
import launchpad as lp

def make_env():
    env = gym.make('FetchReach-v1')
    _ = env.render(mode='rgb_array', height=64, width=64)

_ = make_env() # Successfully creates the env outside lp

# Fails if the above line isn't commented out
# Only works when the line above or everything below is commented
program = lp.Program(name='agent')
env_node = lp.PyNode(make_env)
program.add_node(env_node, label = 'test_node')
lp.launch(program, terminal='current_terminal')

Edit
The issue seems to be with multi-threading (refer to the code example below). Is there any way of bypassing this error with MuJoCo? I am using the following research code released by google research, which happens to be multi-threading with MuJoCo environments.

import gym
import threading

def make_env():
    env = gym.make('FetchReach-v1')
    _ = env.render(mode='rgb_array', height=64, width=64)

_ = make_env() # Successfully creates the env outside lp

thread = threading.Thread(target=make_env)
thread.start()
thread.join()
# >>> ERROR: GLEW initalization error: Missing GL version

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