I recently tried using Gymnasium and run the example:
import gymnasium as gym
env = gym.make("LunarLander-v3", render_mode="human")
observation, info = env.reset(seed=42)
for _ in range(1000):
action = env.action_space.sample() # this is where you would insert your policy
observation, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
observation, info = env.reset()
env.close()
However, I faced error:
Traceback (most recent call last):
File "/Users/raila/Desktop/code/Gymnasium/gymnasium/envs/box2d/bipedal_walker.py", line 15, in <module>
import Box2D
ModuleNotFoundError: No module named 'Box2D'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/raila/Desktop/code/Gymnasium/example.py", line 2, in <module>
env = gym.make("LunarLander-v3", render_mode="human")
File "/Users/raila/Desktop/code/Gymnasium/gymnasium/envs/registration.py", line 702, in make
env_creator = load_env_creator(env_spec.entry_point)
File "/Users/raila/Desktop/code/Gymnasium/gymnasium/envs/registration.py", line 549, in load_env_creator
mod = importlib.import_module(mod_name)
File "/opt/miniconda3/envs/gymnasium-py10/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/raila/Desktop/code/Gymnasium/gymnasium/envs/box2d/__init__.py", line 1, in <module>
from gymnasium.envs.box2d.bipedal_walker import BipedalWalker, BipedalWalkerHardcore
File "/Users/raila/Desktop/code/Gymnasium/gymnasium/envs/box2d/bipedal_walker.py", line 25, in <module>
raise DependencyNotInstalled(
gymnasium.error.DependencyNotInstalled: Box2D is not installed, you can install it by run `pip install swig` followed by `pip install "gymnasium[box2d]"`
I was able to resolve it by
pip install swig
pip install "gymnasium[box2d]"
Is it possible to add these additional packages to the requirements.txt?
Code example
No response
System info
'1.0.0a2'
Additional context
No response
Checklist
[X] I have checked that there is no similar issue in the repo
Describe the bug
Hi,
I recently tried using Gymnasium and run the example:
However, I faced error:
I was able to resolve it by
Is it possible to add these additional packages to the requirements.txt?
Code example
No response
System info
'1.0.0a2'
Additional context
No response
Checklist