openai / gym

A toolkit for developing and comparing reinforcement learning algorithms.
https://www.gymlibrary.dev
Other
34.46k stars 8.59k forks source link

AttributeError: module 'gym.envs.box2d' has no attribute 'CarRacing' #1989

Closed zbp-xxxp closed 3 years ago

zbp-xxxp commented 4 years ago

I've installed the required repository, but it still won't load CarCaring-v0: pip install gym pip install box2d pip install box2d-kengz pip install pyglet

from gym import envs print(envs.registry.all()) [19]dict_values([EnvSpec(Copy-v0), EnvSpec(RepeatCopy-v0), EnvSpec(ReversedAddition-v0), EnvSpec(ReversedAddition3-v0), EnvSpec(DuplicatedInput-v0), EnvSpec(Reverse-v0), EnvSpec(CartPole-v0), EnvSpec(CartPole-v1), EnvSpec(MountainCar-v0), EnvSpec(MountainCarContinuous-v0), EnvSpec(Pendulum-v0), EnvSpec(Acrobot-v1), EnvSpec(LunarLander-v2), EnvSpec(LunarLanderContinuous-v2), EnvSpec(BipedalWalker-v2), EnvSpec(BipedalWalkerHardcore-v2), EnvSpec(CarRacing-v0)

gym里有CarRacing-v0环境,但是我仍然无法加载,是我缺少了某些库吗?求解答,谢谢!

sritee commented 4 years ago

Related https://github.com/openai/gym/issues/1603

pengzhenghao commented 4 years ago

pip install gym[box2d]

alik604 commented 3 years ago

about 2 years it's still broken and still broken. I'm on colab, it's pretty updo date

PaulthiV commented 3 years ago

pip install -e '.[box2d]'

conda install -c anaconda swig

JohDonald commented 3 years ago

pip install -e '.[box2d]'

conda install -c anaconda swig

pip install -e '.[box2d]' , When I try this I get:

ERROR: File "setup.py" not found. Directory cannot be installed in editable mode:

bstee615 commented 3 years ago

@JohDonald It has to be run inside the checked-out repo. This worked for me (Windows, so had to remove the quotes around '.[box2d]').

git clone https://github.com/openai/gym
cd gym
pip install -e .[box2d]
conda install -c anaconda swig
craftsliu commented 3 years ago

pip install gym[box2d]

it work for me ;thanks;

jkterry1 commented 3 years ago

I'm closing this as the issue appears to be resolved

jschultz299 commented 2 years ago

This post solved it for me.

AwesomeAdil commented 1 year ago

The suggestions were helpful for me too. It wasn't working at first but when i made the installations and then made a new notebook it worked like a charm. Just thought i should share.