openai / universe

Universe: a software platform for measuring and training an AI's general intelligence across the world's supply of games, websites and other applications.
https://universe.openai.com
MIT License
7.47k stars 959 forks source link

Pytest for Docker Fails #201

Closed JoeGlobal2014 closed 6 years ago

JoeGlobal2014 commented 7 years ago

I followed the instructions for creating a conda environment then activated it and followed these instructions:

To get started, first install universe:

git clone https://github.com/openai/universe.git cd universe pip install -e .

On Ubuntu 16.04:

pip install numpy sudo apt-get install golang libjpeg-turbo8-dev make

Then I built a docker image, tag it as 'universe':

(dockeruniverse) joe@NeuMachineUbuntu:~/universe$ docker build -t universe . Sending build context to Docker daemon 2.218 MB Step 1 : FROM ubuntu:16.04 ---> 14f60031763d Step 2 : RUN apt-get update && apt-get install -y libav-tools python3-numpy python3-scipy python3-setuptools python3-pip libpq-dev libjpeg-dev curl cmake swig python3-opengl libboost-all-dev libsdl2-dev wget unzip git golang net-tools iptables libvncserver-dev software-properties-common && apt-get clean && rm -rf /var/lib/apt/lists/* ---> Using cache ---> 319881507062 Step 3 : RUN ln -sf /usr/bin/pip3 /usr/local/bin/pip && ln -sf /usr/bin/python3 /usr/local/bin/python && pip install -U pip ---> Using cache ---> 7d141a07a5a6 Step 4 : RUN pip install gym[all] ---> Using cache ---> 6232e3387088 Step 5 : RUN pip install go-vncdriver>=0.4.0 ---> Using cache ---> 454a8ac388ad Step 6 : RUN pip install pytest ---> Using cache ---> 2740184bb046 Step 7 : ENV UNIVERSE_VNCDRIVER 'go' ---> Using cache ---> e0a09d81ecb2 Step 8 : WORKDIR /usr/local/universe/ ---> Running in 57a0ab4eec62 ---> 09ac0e478b37 Removing intermediate container 57a0ab4eec62 Step 9 : COPY ./setup.py ./ ---> c9f5c5005ccc Removing intermediate container 9fff43213213 Step 10 : COPY ./tox.ini ./ ---> 1246c63f4e1e Removing intermediate container 37502033f51d Step 11 : RUN pip install -e . ---> Running in d0d3a30777a1 Obtaining file:///usr/local/universe Collecting autobahn>=0.16.0 (from universe==0.21.5) Downloading autobahn-17.7.1-py2.py3-none-any.whl (278kB) Collecting docker-py==1.10.3 (from universe==0.21.5) Downloading docker_py-1.10.3-py2.py3-none-any.whl (48kB) Collecting docker-pycreds==0.2.1 (from universe==0.21.5) Downloading docker_pycreds-0.2.1-py2.py3-none-any.whl Collecting fastzbarlight>=0.0.13 (from universe==0.21.5) Downloading fastzbarlight-0.0.14.tar.gz (728kB) Requirement already satisfied: go-vncdriver>=0.4.8 in /usr/local/lib/python3.5/dist-packages (from universe==0.21.5) Requirement already satisfied: gym>=0.8.1 in /usr/local/lib/python3.5/dist-packages (from universe==0.21.5) Requirement already satisfied: Pillow>=3.3.0 in /usr/local/lib/python3.5/dist-packages (from universe==0.21.5) Requirement already satisfied: PyYAML>=3.12 in /usr/local/lib/python3.5/dist-packages (from universe==0.21.5) Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.5/dist-packages (from universe==0.21.5) Collecting twisted>=16.5.0 (from universe==0.21.5) Downloading Twisted-17.5.0.tar.bz2 (3.0MB) Collecting ujson>=1.35 (from universe==0.21.5) Downloading ujson-1.35.tar.gz (192kB) Collecting txaio>=2.7.0 (from autobahn>=0.16.0->universe==0.21.5) Downloading txaio-2.8.1-py2.py3-none-any.whl Collecting websocket-client>=0.32.0 (from docker-py==1.10.3->universe==0.21.5) Downloading websocket_client-0.44.0-py2.py3-none-any.whl (199kB) Collecting requests<2.11,>=2.5.2 (from docker-py==1.10.3->universe==0.21.5) Downloading requests-2.10.0-py2.py3-none-any.whl (506kB) Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from go-vncdriver>=0.4.8->universe==0.21.5) Requirement already satisfied: pyglet>=1.2.0 in /usr/local/lib/python3.5/dist-packages (from gym>=0.8.1->universe==0.21.5) Requirement already satisfied: olefile in /usr/local/lib/python3.5/dist-packages (from Pillow>=3.3.0->universe==0.21.5) Collecting zope.interface>=4.0.2 (from twisted>=16.5.0->universe==0.21.5) Downloading zope.interface-4.4.2-cp35-cp35m-manylinux1_x86_64.whl (172kB) Collecting constantly>=15.1 (from twisted>=16.5.0->universe==0.21.5) Downloading constantly-15.1.0-py2.py3-none-any.whl Collecting incremental>=16.10.1 (from twisted>=16.5.0->universe==0.21.5) Downloading incremental-17.5.0-py2.py3-none-any.whl Collecting Automat>=0.3.0 (from twisted>=16.5.0->universe==0.21.5) Downloading Automat-0.6.0-py2.py3-none-any.whl Collecting hyperlink>=17.1.1 (from twisted>=16.5.0->universe==0.21.5) Downloading hyperlink-17.3.0-py2.py3-none-any.whl Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from zope.interface>=4.0.2->twisted>=16.5.0->universe==0.21.5) Collecting attrs (from Automat>=0.3.0->twisted>=16.5.0->universe==0.21.5) Downloading attrs-17.2.0-py2.py3-none-any.whl Building wheels for collected packages: fastzbarlight, twisted, ujson Running setup.py bdist_wheel for fastzbarlight: started Running setup.py bdist_wheel for fastzbarlight: finished with status 'done' Stored in directory: /root/.cache/pip/wheels/21/4a/64/5be2c657a496c2322d6cbaf8a1b0f8d6151355870706fd297f Running setup.py bdist_wheel for twisted: started Running setup.py bdist_wheel for twisted: finished with status 'done' Stored in directory: /root/.cache/pip/wheels/57/08/00/28a9a86f0ee9f54260fb5949aed2e69b0425e8a878757aa7ce Running setup.py bdist_wheel for ujson: started Running setup.py bdist_wheel for ujson: finished with status 'done' Stored in directory: /root/.cache/pip/wheels/9e/9b/d0/df92653bb5b2664c15d8ee5b99e3f2eb08a034444db8922b2f Successfully built fastzbarlight twisted ujson Installing collected packages: txaio, autobahn, websocket-client, docker-pycreds, requests, docker-py, fastzbarlight, zope.interface, constantly, incremental, attrs, Automat, hyperlink, twisted, ujson, universe Found existing installation: requests 2.18.3 Uninstalling requests-2.18.3: Successfully uninstalled requests-2.18.3 Running setup.py develop for universe Successfully installed Automat-0.6.0 attrs-17.2.0 autobahn-17.7.1 constantly-15.1.0 docker-py-1.10.3 docker-pycreds-0.2.1 fastzbarlight-0.0.14 hyperlink-17.3.0 incremental-17.5.0 requests-2.10.0 twisted-17.5.0 txaio-2.8.1 ujson-1.35 universe websocket-client-0.44.0 zope.interface-4.4.2 ---> c563b1845509 Removing intermediate container d0d3a30777a1 Step 12 : COPY . ./ ---> 7668b59df41c Removing intermediate container 48e56a071e43 Step 13 : RUN py3clean . ---> Running in dca034602a72 ---> ac4184310def Removing intermediate container dca034602a72 Successfully built ac4184310def

Then I ran: docker run --privileged --rm -e DOCKER_NET_HOST=172.17.0.1 -v /var/run/docker.sock:/var/run/docker.sock universe pytest

It had erros

(dockeruniverse) joe@NeuMachineUbuntu:~/universe$ docker run --privileged --rm -e DOCKER_NET_HOST=172.17.0.1 -v /var/run/docker.sock:/var/run/docker.sock universe pytest ============================= test session starts ============================== platform linux -- Python 3.5.2, pytest-3.2.1, py-1.4.34, pluggy-0.4.0 rootdir: /usr/local/universe, inifile: collected 22 items

tests/functional/test_core_envs_semantics.py FF tests/functional/test_envs.py .. universe/envs/tests/test_semantics.py ...... universe/rewarder/tests/test_reward_buffer.py ..... universe/vectorized/tests/test_monitoring.py FF universe/wrappers/tests/test_joint.py . universe/wrappers/tests/test_time_limit.py ....

=================================== FAILURES =================================== ____ test_nice_vnc_semantics_match[spec0-matcher0-wrapper0] ____

self = <gym.envs.registration.EnvRegistry object at 0x7fe83e6e75c0> id = 'PongDeterministic-v3'

def spec(self, id):
    match = env_id_re.search(id)
    if not match:
        raise error.Error('Attempted to look up malformed environment ID: {}. (Currently all IDs must be of the form {}.)'.format(id.encode('utf-8'), env_id_re.pattern))

    try:
      return self.env_specs[id]

E KeyError: 'PongDeterministic-v3'

../lib/python3.5/dist-packages/gym/envs/registration.py:137: KeyError

During handling of the above exception, another exception occurred:

spec = EnvSpec(gym-core.PongDeterministicSync-v3) matcher = <test_core_envs_semantics.AtariMatcher object at 0x7fe8417a7f98> wrapper = <function atari_vnc_wrapper at 0x7fe835df2d08>

@pytest.mark.parametrize("spec,matcher,wrapper", specs)
def test_nice_vnc_semantics_match(spec, matcher, wrapper):
    # Check that when running over VNC or using the raw environment,
    # semantics match exactly.
    gym.undo_logger_setup()
    logging.getLogger().setLevel(logging.INFO)

    spaces.seed(0)
  vnc_env = spec.make()

tests/functional/test_core_envs_semantics.py:92:


===================== 4 failed, 18 passed in 11.82 seconds ===================== Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/gym/utils/closer.py", line 67, in close closeable.close() File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 164, in close self.render(close=True) File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 150, in render return self._render(mode=mode, close=close) File "/usr/local/universe/universe/vectorized/multiprocessing_env.py", line 310, in _render return render_n(self.worker_n, mode=mode, close=close) File "/usr/local/universe/universe/vectorized/multiprocessing_env.py", line 230, in render_n worker_n = worker_n[0:] TypeError: 'NoneType' object is not subscriptable Exception ignored in: <bound method Env.del of <universe.vectorized.multiprocessing_env.MultiprocessingEnv object at 0x7fe835da5c18>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 203, in del self.close() File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 164, in close self.render(close=True) File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 150, in render return self._render(mode=mode, close=close) File "/usr/local/universe/universe/vectorized/multiprocessing_env.py", line 310, in _render return render_n(self.worker_n, mode=mode, close=close) File "/usr/local/universe/universe/vectorized/multiprocessing_env.py", line 230, in render_n worker_n = worker_n[0:] TypeError: 'NoneType' object is not subscriptable

Versions

Please include the result of running Linux NeuMachineUbuntu 4.4.0-89-generic #112-Ubuntu SMP Mon Jul 31 19:38:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux Python 3.6.1 :: Anaconda custom (64-bit) Name: universe Version: 0.21.5 Summary: Universe: a software platform for measuring and training an AI's general intelligence across the world's supply of games, websites and other applications. Home-page: https://github.com/openai/universe Author: OpenAI Author-email: universe@openai.com License: UNKNOWN Location: /home/joe/universe Requires: autobahn, docker-py, docker-pycreds, fastzbarlight, go-vncdriver, gym, Pillow, PyYAML, six, twisted, ujson

Name: gym Version: 0.9.2 Summary: The OpenAI Gym: A toolkit for developing and comparing your reinforcement learning agents. Home-page: https://github.com/openai/gym Author: OpenAI Author-email: gym@openai.com License: UNKNOWN Location: /home/joe/anaconda3/lib/python3.6/site-packages Requires: requests, six, numpy, pyglet

Name: numpy Version: 1.13.1 Summary: NumPy: array processing for numbers, strings, records, and objects. Home-page: http://www.numpy.org Author: NumPy Developers Author-email: numpy-discussion@python.org License: BSD Location: /home/joe/anaconda3/lib/python3.6/site-packages Requires:

Name: go-vncdriver Version: 0.4.19 Summary: UNKNOWN Home-page: UNKNOWN Author: UNKNOWN Author-email: UNKNOWN License: UNKNOWN Location: /home/joe/anaconda3/lib/python3.6/site-packages Requires: numpy

Name: Pillow Version: 4.1.1 Summary: Python Imaging Library (Fork) Home-page: https://python-pillow.org Author: Alex Clark (Fork Author) Author-email: aclark@aclark.net License: Standard PIL License Location: /home/joe/anaconda3/lib/python3.6/site-packages Requires: olefile

I am not sure what to do next. It seems like a registration python script is not well formed or deprecated.

Thanks

Joe

MTorosyan commented 7 years ago

I am having the exact same issue and have come across one other person who has had this issue on stackoverflow: https://stackoverflow.com/questions/45201512/openai-universe-test-failing-using-docker

I'll try a few things in the morning, hopefully with more luck than tonight.

JoeGlobal2014 commented 7 years ago

@MTorosyan have you figured it out? Im still trying I reinstalled gym and universe and still getting this error

MTorosyan commented 7 years ago

@JoeGlobal2014 Unfortunately not, I have also tried reinstalling with no luck. Although it has not stopped me from developing as of yet. Are you able to run an example bit of code that launches a docker environment?

McTschecker commented 7 years ago

I have the same issue, any solution? I tried it a couple times and always the same error I tried it on MacOS HighSierra

balldel commented 7 years ago

Same issue . Anyone have solution??

ErikThorsell commented 7 years ago

When running the test I got stuck at the second test (i.e. I only got to the output below):

platform linux -- Python 3.5.2, pytest-3.2.1, py-1.4.34, pluggy-0.4.0
rootdir: /usr/local/universe, inifile:
collected 22 items

tests/functional/test_core_envs_semantics.py FF
tests/functional/test_envs.py ..

After a couple of minutes I aborted the test and was presented with the same output as above. Running the DuskDrive-test does however seem to work well.

I did a fresh install of docker, and followed the instructions above. I am running arch with kernel 4.12.10-1.

AwokeKnowing commented 7 years ago

Same issue as OP with tests failing. It mentions pong v3 several times and I think maybe the tests aren't updated to v4 or something

nevaryyy commented 7 years ago

same issue, anyone help~

AwokeKnowing commented 7 years ago

@nevaryyy I think the tests are just out of date. They're probably hard at work on the Dota stuff, but I guess it's an 'open source' project so we'll have to all work together to move the software forward, you included!

ronin-cunningham commented 6 years ago

Same problem.

ghost commented 6 years ago

I've been having this same problem recently, and I think that the problem may have something to do with the wrong script/module being imported somewhere.

mingxuts commented 6 years ago

Same problem as OP. would try a release version rather than clone, hope more luck

michaelcraiger commented 6 years ago

Same issue as Erik

xuedong commented 6 years ago

same for me