Skip to content

Commit

Permalink
Update prompt messages for extra dependencies (openai#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan authored Jan 9, 2023
1 parent 1dfdf45 commit 5af90e3
Show file tree
Hide file tree
Showing 28 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
hooks:
- id: codespell
args:
- --ignore-words-list=nd,reacher,thist,ths,ure,referenc,wile
- --ignore-words-list=reacher,ure,referenc,wile
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
Expand Down
2 changes: 1 addition & 1 deletion docs/environments/classic_control.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classic_control/pendulum
The unique dependencies for this set of environments can be installed via:

````bash
pip install gymnasium[classic_control]
pip install gymnasium[classic-control]
````

There are five classic control environments: Acrobot, CartPole, Mountain Car, Continuous Mountain Car, and Pendulum. All of these environments are stochastic in terms of their initial state, within a given range. In addition, Acrobot has noise applied to the taken action. Also, regarding both mountain car environments, the cars are underpowered to climb the mountain, so it takes some effort to reach the top.
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/box2d/bipedal_walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)
except ImportError as e:
raise DependencyNotInstalled(
"box2D is not installed, run `pip install gymnasium[box2d]`"
"Box2D is not installed, run `pip install gymnasium[box2d]`"
) from e


Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/box2d/car_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from Box2D.b2 import fixtureDef, polygonShape, revoluteJointDef
except ImportError as e:
raise DependencyNotInstalled(
"box2D is not installed, run `pip install gymnasium[box2d]`"
"Box2D is not installed, run `pip install gymnasium[box2d]`"
) from e


Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/box2d/car_racing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from Box2D.b2 import contactListener, fixtureDef, polygonShape
except ImportError as e:
raise DependencyNotInstalled(
"box2D is not installed, run `pip install gymnasium[box2d]`"
"Box2D is not installed, run `pip install gymnasium[box2d]`"
) from e

try:
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/box2d/lunar_lander.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
)
except ImportError as e:
raise DependencyNotInstalled(
"box2d is not installed, run `pip install gymnasium[box2d]`"
"Box2D is not installed, run `pip install gymnasium[box2d]`"
) from e


Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/classic_control/acrobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def render(self):
from pygame import gfxdraw
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e

if self.screen is None:
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/classic_control/cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def render(self):
from pygame import gfxdraw
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e

if self.screen is None:
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/classic_control/continuous_mountain_car.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def render(self):
from pygame import gfxdraw
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e

if self.screen is None:
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/classic_control/mountain_car.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def render(self):
from pygame import gfxdraw
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e

if self.screen is None:
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/classic_control/pendulum.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def render(self):
from pygame import gfxdraw
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e

if self.screen is None:
Expand Down
7 changes: 5 additions & 2 deletions gymnasium/envs/mujoco/mujoco_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ def __init__(
):
if MUJOCO_PY_IMPORT_ERROR is not None:
raise error.DependencyNotInstalled(
f"{MUJOCO_PY_IMPORT_ERROR}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)"
f"{MUJOCO_PY_IMPORT_ERROR}. "
"(HINT: you need to install mujoco-py, and also perform the setup instructions "
"here: https://github.com/openai/mujoco-py.)"
)

logger.warn(
Expand Down Expand Up @@ -324,7 +326,8 @@ def __init__(
):
if MUJOCO_IMPORT_ERROR is not None:
raise error.DependencyNotInstalled(
f"{MUJOCO_IMPORT_ERROR}. (HINT: you need to install mujoco)"
f"{MUJOCO_IMPORT_ERROR}. "
"(HINT: you need to install mujoco, run `pip install gymnasium[mujoco]`.)"
)

super().__init__(
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/mujoco/mujoco_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def _get_viewer(self, render_mode: str):
self.viewer = OffScreenViewer(self.model, self.data)
else:
raise AttributeError(
f"Unexpected mode: {render_mode}, expected modes: human, rgb_arrray, or depth_array"
f"Unexpected mode: {render_mode}, expected modes: human, rgb_array, or depth_array"
)
# Add default camera parameters
self._set_cam_config()
Expand Down
6 changes: 3 additions & 3 deletions gymnasium/envs/phys2d/cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def render_image(
from pygame import gfxdraw
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e
screen, clock = render_state

Expand Down Expand Up @@ -216,7 +216,7 @@ def render_init(
import pygame
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e

pygame.init()
Expand All @@ -231,7 +231,7 @@ def render_close(self, render_state: RenderStateType) -> None:
import pygame
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e
pygame.display.quit()
pygame.quit()
Expand Down
6 changes: 3 additions & 3 deletions gymnasium/envs/phys2d/pendulum.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def render_image(
from pygame import gfxdraw
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e
screen, clock, last_u = render_state

Expand Down Expand Up @@ -168,7 +168,7 @@ def render_init(
import pygame
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e

pygame.init()
Expand All @@ -183,7 +183,7 @@ def render_close(self, render_state: RenderStateType):
import pygame
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e
pygame.display.quit()
pygame.quit()
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/toy_text/blackjack.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def render(self):
import pygame
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[toy_text]`"
"pygame is not installed, run `pip install gymnasium[toy-text]`"
) from e

player_sum, dealer_card_value, usable_ace = self._get_obs()
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/toy_text/cliffwalking.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def _render_gui(self, mode):
import pygame
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[toy_text]`"
"pygame is not installed, run `pip install gymnasium[toy-text]`"
) from e
if self.window_surface is None:
pygame.init()
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/toy_text/frozen_lake.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def _render_gui(self, mode):
import pygame
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[toy_text]`"
"pygame is not installed, run `pip install gymnasium[toy-text]`"
) from e

if self.window_surface is None:
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/toy_text/taxi.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def _render_gui(self, mode):
import pygame # dependency to pygame only if rendering with human
except ImportError as e:
raise DependencyNotInstalled(
"pygame is not installed, run `pip install gymnasium[toy_text]`"
"pygame is not installed, run `pip install gymnasium[toy-text]`"
) from e

if self.window is None:
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/experimental/wrappers/jax_to_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __init__(self, env: Env):
"""
if jnp is None:
raise DependencyNotInstalled(
"Jax is not installed, run `pip install gymnasium[jax]`"
"jax is not installed, run `pip install gymnasium[jax]`"
)
super().__init__(env)

Expand Down
4 changes: 2 additions & 2 deletions gymnasium/experimental/wrappers/jax_to_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ def __init__(self, env: Env, device: Device | None = None):
"""
if torch is None:
raise DependencyNotInstalled(
"Torch is not installed, run `pip install torch`"
"torch is not installed, run `pip install torch`"
)
elif jnp is None:
raise DependencyNotInstalled(
"Jax is not installed, run `pip install gymnasium[jax]`"
"jax is not installed, run `pip install gymnasium[jax]`"
)

super().__init__(env)
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/experimental/wrappers/lambda_observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def __init__(self, env: gym.Env, shape: tuple[int, ...]):
import cv2
except ImportError as e:
raise DependencyNotInstalled(
"opencv is not installed, run `pip install gymnasium[other]`"
"opencv (cv2) is not installed, run `pip install gymnasium[other]`"
) from e

self.shape: Final[tuple[int, ...]] = tuple(shape)
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/experimental/wrappers/numpy_to_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(self, env: Env, device: Device | None = None):
"""
if torch is None:
raise DependencyNotInstalled(
"Torch is not installed, run `pip install torch`"
"torch is not installed, run `pip install torch`"
)

super().__init__(env)
Expand Down
4 changes: 2 additions & 2 deletions gymnasium/utils/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pygame.event import Event
except ImportError as e:
raise gym.error.DependencyNotInstalled(
"Pygame is not installed, run `pip install gymnasium[classic_control]`"
"pygame is not installed, run `pip install gymnasium[classic-control]`"
) from e

try:
Expand All @@ -26,7 +26,7 @@
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
except ImportError:
logger.warn("Matplotlib is not installed, run `pip install gymnasium[other]`")
logger.warn("matplotlib is not installed, run `pip install gymnasium[other]`")
matplotlib, plt = None, None


Expand Down
2 changes: 1 addition & 1 deletion gymnasium/utils/save_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
except ImportError as e:
raise gym.error.DependencyNotInstalled(
"MoviePy is not installed, run `pip install moviepy`"
"moviepy is not installed, run `pip install moviepy`"
) from e


Expand Down
4 changes: 2 additions & 2 deletions gymnasium/wrappers/monitoring/video_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(
import moviepy # noqa: F401
except ImportError as e:
raise error.DependencyNotInstalled(
"MoviePy is not installed, run `pip install moviepy`"
"moviepy is not installed, run `pip install moviepy`"
) from e

self._async = env.metadata.get("semantics.async")
Expand Down Expand Up @@ -153,7 +153,7 @@ def close(self):
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
except ImportError as e:
raise error.DependencyNotInstalled(
"MoviePy is not installed, run `pip install moviepy`"
"moviepy is not installed, run `pip install moviepy`"
) from e

clip = ImageSequenceClip(self.recorded_frames, fps=self.frames_per_sec)
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/wrappers/resize_observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def observation(self, observation):
import cv2
except ImportError as e:
raise DependencyNotInstalled(
"opencv is not installed, run `pip install gymnasium[other]`"
"opencv (cv2) is not installed, run `pip install gymnasium[other]`"
) from e

observation = cv2.resize(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ box2d = ["box2d-py ==2.3.5", "pygame ==2.1.3.dev8", "swig ==4.*"]
classic-control = ["pygame ==2.1.3.dev8"]
classic_control = ["pygame ==2.1.3.dev8"] # kept for backward compatibility
mujoco-py = ["mujoco-py >=2.1,<2.2"]
mujoco_py = ["mujoco-py >=2.1,<2.2"] # kept for backward compatibility
mujoco_py = ["mujoco-py >=2.1,<2.2"] # kept for backward compatibility
mujoco = ["mujoco >=2.3.1.post1", "imageio >=2.14.1"]
toy-text = ["pygame ==2.1.3.dev8"]
toy_text = ["pygame ==2.1.3.dev8"] # kept for backward compatibility
Expand Down

0 comments on commit 5af90e3

Please sign in to comment.