Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin gym version in Python 2 tests. #3973

Merged
merged 1 commit into from
Feb 7, 2019

Conversation

robertnishihara
Copy link
Collaborator

Looks like gym just released a new version that broke our tests in Python 2. https://pypi.org/project/gym/0.11.0/#history

@robertnishihara
Copy link
Collaborator Author

E.g.,

$ python -m pytest -v --durations=10 python/ray/rllib/test/test_catalog.py
============================= test session starts ==============================
platform linux2 -- Python 2.7.15, pytest-4.2.0, py-1.7.0, pluggy-0.8.1 -- /home/travis/miniconda/bin/python
cachedir: .pytest_cache
rootdir: /home/travis/build/ray-project/ray/python, inifile:
plugins: timeout-1.3.3, flaky-3.5.3
collected 5 items                                                              
python/ray/rllib/test/test_catalog.py::ModelCatalogTest::testCustomModel FAILED [ 20%]
python/ray/rllib/test/test_catalog.py::ModelCatalogTest::testCustomPreprocessor FAILED [ 40%]
python/ray/rllib/test/test_catalog.py::ModelCatalogTest::testDefaultModels FAILED [ 60%]
python/ray/rllib/test/test_catalog.py::ModelCatalogTest::testGymPreprocessors FAILED [ 80%]
python/ray/rllib/test/test_catalog.py::ModelCatalogTest::testTuplePreprocessor FAILED [100%]
=================================== FAILURES ===================================
_______________________ ModelCatalogTest.testCustomModel _______________________
self = <ray.rllib.test.test_catalog.ModelCatalogTest testMethod=testCustomModel>
    def testCustomModel(self):
        ray.init()
        ModelCatalog.register_custom_model("foo", CustomModel)
        p1 = ModelCatalog.get_model({
            "obs": tf.constant([1, 2, 3])
>       }, Box(0, 1, shape=(3, ), dtype=np.float32), 5,
                                    {"custom_model": "foo"})
python/ray/rllib/test/test_catalog.py:90: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <[AttributeError("'Box' object has no attribute 'shape'") raised in repr()] SafeRepr object at 0x7fc58d45a878>
low = array([0., 0., 0.]), high = array([1., 1., 1.]), shape = (3,)
dtype = <type 'numpy.float32'>
    def __init__(self, low=None, high=None, shape=None, dtype=None):
        """
        Two kinds of valid input:
            Box(low=-1.0, high=1.0, shape=(3,4)) # low and high are scalars, and shape is provided
            Box(low=np.array([-1.0,-2.0]), high=np.array([2.0,4.0])) # low and high are arrays of the same shape
        """
        if shape is None:
            assert low.shape == high.shape
            shape = low.shape
        else:
            assert np.isscalar(low) and np.isscalar(high)
            low = low + np.zeros(shape)
            high = high + np.zeros(shape)
        if dtype is None:  # Autodetect type
            if (high == 255).all():
                dtype = np.uint8
            else:
                dtype = np.float32
            logger.warn("gym.spaces.Box autodetected dtype as {}. Please provide explicit dtype.".format(dtype))
        self.low = low.astype(dtype)
        self.high = high.astype(dtype)
>       super().__init__(shape, dtype)
E       TypeError: super() takes at least 1 argument (0 given)

@ericl
Copy link
Contributor

ericl commented Feb 7, 2019

We should actually not pin it right? Otherwise, gym will break us without us noticing.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/11631/
Test PASSed.

@robertnishihara
Copy link
Collaborator Author

robertnishihara commented Feb 7, 2019

@ericl Gym already broke rllib, which is why I submitted this PR. I was going to pin it until the issue is fixed in gym, since I don't think we can work around it. It's just a syntax error in gym.

I can submit a patch upstream, but we still need to wait for gym to do a new release.

@robertnishihara
Copy link
Collaborator Author

robertnishihara commented Feb 7, 2019

See openai/gym#1312.

@ericl
Copy link
Contributor

ericl commented Feb 7, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants