Skip to content

Commit

Permalink
Fix mujoco_py only installation
Browse files Browse the repository at this point in the history
Only import `mujoco_rendering` when `mujoco` installed.
Otherwise the `try import` code in `gym.envs.mujoco.mujoco_env` is useless.
  • Loading branch information
YouJiacheng committed Sep 7, 2022
1 parent 824507b commit 7afacac
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gym/envs/mujoco/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from gym.envs.mujoco.mujoco_env import MujocoEnv, MuJocoPyEnv # isort:skip
from gym.envs.mujoco.mujoco_rendering import ( # isort:skip
RenderContextOffscreen,
Viewer,
)
from gym.envs.mujoco.mujoco_env import MujocoEnv, MuJocoPyEnv, MUJOCO_NOT_INSTALLED # isort:skip
if not MUJOCO_NOT_INSTALLED:
from gym.envs.mujoco.mujoco_rendering import ( # isort:skip
RenderContextOffscreen,
Viewer,
)


# ^^^^^ so that user gets the correct error
# message if mujoco is not installed correctly
Expand Down

0 comments on commit 7afacac

Please sign in to comment.