Skip to content

Commit

Permalink
Fix build with latest gym (openai#1034)
Browse files Browse the repository at this point in the history
* update to use latest version of gym

* fix imports

* narrow down gym version to 0.15.4 <= gym < 0.16.0
  • Loading branch information
pzhokhov authored Nov 10, 2019
1 parent 391811d commit 9ee399f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions baselines/common/cmd_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
MPI = None

import gym
from gym.wrappers import FlattenDictWrapper
from gym.wrappers import FlattenObservation, FilterObservation
from baselines import logger
from baselines.bench import Monitor
from baselines.common import set_global_seeds
Expand Down Expand Up @@ -81,8 +81,7 @@ def make_env(env_id, env_type, mpi_rank=0, subrank=0, seed=None, reward_scale=1.
env = gym.make(env_id, **env_kwargs)

if flatten_dict_observations and isinstance(env.observation_space, gym.spaces.Dict):
keys = env.observation_space.spaces.keys()
env = gym.wrappers.FlattenDictWrapper(env, dict_keys=list(keys))
env = FlattenObservation(env)

env.seed(seed + subrank if seed is not None else None)
env = Monitor(env,
Expand Down Expand Up @@ -128,7 +127,7 @@ def make_robotics_env(env_id, seed, rank=0):
"""
set_global_seeds(seed)
env = gym.make(env_id)
env = FlattenDictWrapper(env, ['observation', 'desired_goal'])
env = FlattenObservation(FilterObservation(env, ['observation', 'desired_goal']))
env = Monitor(
env, logger.get_dir() and os.path.join(logger.get_dir(), str(rank)),
info_keywords=('is_success',))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
packages=[package for package in find_packages()
if package.startswith('baselines')],
install_requires=[
'gym>=0.10.0, <1.0.0',
'gym>=0.15.4, <0.16.0',
'scipy',
'tqdm',
'joblib',
Expand Down

0 comments on commit 9ee399f

Please sign in to comment.