Skip to content

Commit 085a35d

Browse files
authored
Fix broken Box2D dependency in fresh install (#335)
* Fix Box2D in fresh install (#334) Before box2d-py 2.3.4, box2d-py works on Linux but breaks on OSX, and Box2D-kengz works on OSX but breaks on Linux. box2d-py 2.3.4 fixes issue on OSX and now works on both platforms, and is actively by OpenAI. See openai/gym#1120. * Cleanup (#334) * Cleanup extra pip (#334) Remove pip box2d-py in - setup_linux.sh - setup_osx.sh - Dockerfile.ci * Upgrade gym to 0.10.8 (#334) * Remove assertion for Mujoco viewer close This problem is resolved in #340 * Close all env * Remove deadcode KNOWN_GYM_CLOSE_BROKEN
1 parent a99483c commit 085a35d

File tree

6 files changed

+3
-89
lines changed

6 files changed

+3
-89
lines changed

docker/Dockerfile.ci

-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ RUN echo "${MJKEY}" > /root/.mujoco/mjkey.txt && \
9292
# Extras
9393
# prevent pip from complaining about available upgrades
9494
RUN ["/bin/bash", "-c", "source activate garage && pip install --upgrade pip"]
95-
# Fix Box2D install
96-
# See https://github.com/openai/gym/issues/100
97-
# See https://github.com/pybox2d/pybox2d/issues/82
98-
RUN ["/bin/bash", "-c", "source activate garage && pip uninstall -y Box2D Box2D-kengz box2d-py && pip install Box2D"]
9995

10096
# Setup repo
10197
WORKDIR /root/code/garage

environment.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dependencies:
1515
# Please keep alphabetized
1616
- awscli
1717
- boto3
18-
- Box2D>=2.3.2
1918
- cached_property
2019
- cloudpickle
2120
- cma==1.1.06
@@ -25,7 +24,8 @@ dependencies:
2524
# installed. This is stupid, but harmless.
2625
- git+https://github.com/deepmind/dm_control.git@c24ec9f5f3cb3c25c6571c89c9f60bf3350f5711#egg=dm_control
2726
- flask
28-
- gym[all]==0.10.5
27+
- gym[all]==0.10.8
28+
- box2d-py>=2.3.4
2929
- hyperopt
3030
- ipdb
3131
- ipywidgets

scripts/setup_linux.sh

-6
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,6 @@ conda activate garage
218218
conda install pygpu
219219
fi
220220

221-
# Fix Box2D install
222-
# See https://github.com/openai/gym/issues/100
223-
# See https://github.com/pybox2d/pybox2d/issues/82
224-
pip uninstall -y Box2D Box2D-kengz box2d-py
225-
pip install Box2D
226-
227221
# We need a MuJoCo key to import mujoco_py
228222
cp ${_arg_mjkey} "${HOME}"/.mujoco/mjkey.txt
229223

scripts/setup_osx.sh

-6
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,6 @@ conda activate garage
227227
# 'Install' garage as an editable package
228228
pip install -e .
229229

230-
# Fix Box2D install
231-
# See https://github.com/openai/gym/issues/100
232-
# See https://github.com/pybox2d/pybox2d/issues/82
233-
pip uninstall -y Box2D Box2D-kengz box2d-py
234-
pip install Box2D-kengz --no-binary Box2D-kengz
235-
236230
# We need a MuJoCo key to import mujoco_py
237231
cp ${_arg_mjkey} "${HOME}"/.mujoco/mjkey.txt
238232

tests/helpers.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pickle
22

3-
from tests.quirks import KNOWN_GYM_CLOSE_BROKEN
43
from tests.quirks import KNOWN_GYM_RENDER_NOT_IMPLEMENTED
54

65

@@ -44,9 +43,4 @@ def step_env_with_gym_quirks(test_case,
4443
round_trip = pickle.loads(pickle.dumps(env))
4544
assert round_trip.env.spec == env.env.spec
4645

47-
if not spec.id in KNOWN_GYM_CLOSE_BROKEN:
48-
env.close()
49-
else:
50-
with test_case.assertRaisesRegex(
51-
AttributeError, "'MjViewer' object has no attribute 'finish'"):
52-
env.close()
46+
env.close()

tests/quirks.py

-64
Original file line numberDiff line numberDiff line change
@@ -21,70 +21,6 @@
2121
"Roulette-v0",
2222
]
2323

24-
# openai/gym environments known to have a broken close() function.
25-
#
26-
# e.g.
27-
# > gym/envs/robotics/robot_env.py", line 86, in close
28-
# > self.viewer.finish()
29-
# > AttributeError: 'MjViewer' object has no attribute 'finish'
30-
# >
31-
#
32-
# Tests calling close() on these should verify they raise AttributeError
33-
# ```
34-
# with self.assertRaises(NotImplementedError):
35-
# env.close()
36-
# ```
37-
#
38-
# TODO: file a bug at openai/gym about this
39-
KNOWN_GYM_CLOSE_BROKEN = [
40-
# Please keep alphabetized
41-
"Ant-v2",
42-
"FetchPickAndPlace-v1",
43-
"FetchPickAndPlaceDense-v1",
44-
"FetchPush-v1",
45-
"FetchPushDense-v1",
46-
"FetchReach-v1",
47-
"FetchReachDense-v1",
48-
"FetchSlide-v1",
49-
"FetchSlideDense-v1",
50-
"HalfCheetah-v2",
51-
"HandManipulateBlock-v0",
52-
"HandManipulateBlockDense-v0",
53-
"HandManipulateBlockFull-v0",
54-
"HandManipulateBlockFullDense-v0",
55-
"HandManipulateBlockRotateParallel-v0",
56-
"HandManipulateBlockRotateParallelDense-v0",
57-
"HandManipulateBlockRotateXYZ-v0",
58-
"HandManipulateBlockRotateXYZDense-v0",
59-
"HandManipulateBlockRotateZ-v0",
60-
"HandManipulateBlockRotateZDense-v0",
61-
"HandManipulateEgg-v0",
62-
"HandManipulateEggDense-v0",
63-
"HandManipulateEggFull-v0",
64-
"HandManipulateEggFullDense-v0",
65-
"HandManipulateEggRotate-v0",
66-
"HandManipulateEggRotateDense-v0",
67-
"HandManipulatePen-v0",
68-
"HandManipulatePenDense-v0",
69-
"HandManipulatePenFull-v0",
70-
"HandManipulatePenFullDense-v0",
71-
"HandManipulatePenRotate-v0",
72-
"HandManipulatePenRotateDense-v0",
73-
"HandReach-v0",
74-
"HandReachDense-v0",
75-
"Hopper-v2",
76-
"Humanoid-v2",
77-
"HumanoidStandup-v2",
78-
"InvertedDoublePendulum-v2",
79-
"InvertedPendulum-v2",
80-
"Pusher-v2",
81-
"Reacher-v2",
82-
"Striker-v2",
83-
"Swimmer-v2",
84-
"Thrower-v2",
85-
"Walker2d-v2",
86-
]
87-
8824
KNOWN_GYM_NOT_CLOSE_VIEWER = [
8925
# Please keep alphabetized
9026
"gym.envs.mujoco",

0 commit comments

Comments
 (0)