Skip to content
This repository has been archived by the owner on Apr 6, 2018. It is now read-only.

Unable to import universe, No module named benchmarks in newest gym (0.9.6) #228

Closed
Accessant opened this issue Jan 30, 2018 · 8 comments
Closed

Comments

@Accessant
Copy link

Accessant commented Jan 30, 2018

EDIT: The running theory is that the current version of universe is incompatible with the new version of gym!! It sounds like gym removed the benchmarks from its package, which universe uses.

I cannot import universe. I get an error

from gym.benchmarks import scoring
ImportError: No module named 'gym.benchmarks'

full code:
python
>>> import gym
>>> import universe -> error

I followed this guide line by line. The only warning message anywhere in the process was an error with mujico when I ran pip install -e .[all] - I reran it as just pip install -e . and gym installed without error. Also, I read #103 and the poster did a complete OS reinstall, which bypassed the error. I tried to do the same - I repartitioned my Ubuntu 14.04 computer, installed a vanilla 16.06 Ubuntu, and ran into the same error! Argh.

As per requested information on #103,
gym.__file__ = '/home/orion/gym/gym/__init__.py'

Someone on Reddit wants me to let them know when I solve this.

Thanks you for your help.

Version Dump:


Linux orion-XXXXXXX-ABA-p6320y 4.13.0-32-generic #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


Python 3.5.3 :: 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/orion/universe
Requires: autobahn, docker-py, docker-pycreds, fastzbarlight, go-vncdriver, gym, Pillow, PyYAML, six, twisted, ujson


Name: gym
Version: 0.9.6
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/orion/gym
Requires: numpy, requests, six, pyglet


Name: tensorflow
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /home/orion/anaconda3/envs/universe/lib/python3.5/site-packages
Requires: six, tensorflow-tensorboard, numpy, protobuf, wheel, absl-py


Name: numpy
Version: 1.14.0
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/orion/anaconda3/envs/universe/lib/python3.5/site-packages
Requires:


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


Name: Pillow
Version: 3.4.2
Summary: Python Imaging Library (Fork)
Home-page: http://python-pillow.org
Author: Alex Clark (Fork Author)
Author-email: aclark@aclark.net
License: Standard PIL License
Location: /home/orion/anaconda3/envs/universe/lib/python3.5/site-packages
Requires:


dir(gym) produces:
['ActionWrapper', 'Env', 'ObservationWrapper', 'RewardWrapper', 'Space', 'Wrapper', 'all', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'version', 'core', 'distutils', 'envs', 'error', 'logger', 'make', 'os', 'reraise', 'spaces', 'spec', 'sys', 'undo_logger_setup', 'utils', 'version', 'warnings', 'wrappers']


Edit: I created another anaconda environment without docker/tensorflow/opencv, and it ran into the same error message.

@dukeimg
Copy link

dukeimg commented Jan 31, 2018

I'm running through the same issue. It seems like the entire benchmarks package was removed from gym few days ago

openai/gym@4c460ba#diff-170d6bbf20fa02890840c39b9fbb66a0

As a temporary solution I can suggest a manual downgrade of gym to 0.9.5

pip uninstall gym
pip install gym==0.9.5

@Accessant Accessant changed the title Unable to import universe, No module named benchmarks Unable to import universe, No module named benchmarks in newest gym (0.9.6) Jan 31, 2018
@Accessant
Copy link
Author

Accessant commented Jan 31, 2018

Dukeimg = I can confirm, this solved my problem. THANK YOU. I'll leave it as open because it's a major problem for the universe team.

Also - the pip install gym==0.9.5 didn't for for me (it installed the newest version anyway) so I grabbed the 0.9.5 version from here.

@frogoscar
Copy link

pip uninstall gym
pip install gym==0.9.5

It works.

@wlong0827
Copy link

Thanks so much for this Issue! I've been running around for the last two days trying to find a solution to all the errors this caused for me. I would suggest that you add this fix to the README

@ShaShekhar
Copy link

pip uninstall gym
pip install gym==0.9.5

Really It works.Thanks

@ShaShekhar
Copy link

ShaShekhar commented Mar 12, 2018

when i use only gym then there is no error.
and when use gym and universe both then error occur.
I install universe and docker properly as per given instruction on github openai/universe page.
THE ERROR I GOT
shashank@shashank-HP-Notebook:~/Documents/Policy_Gradients_to_beat_Pong-master$ sudo python3 test.py
[2018-03-12 21:56:33,886] Making new env: flashgames.DuskDrive-v0
[2018-03-12 21:56:33,895] Writing logs to file: /tmp/universe-18074.log
Traceback (most recent call last):
File "/home/shashank/.local/lib/python3.6/site-packages/docker/client.py", line 87, in _raise_for_status
response.raise_for_status()
File "/usr/local/lib/python3.6/dist-packages/requests/models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+unix://var/run/docker.sock/vauto/containers/json?limit=-1&all=0&size=0&trunc_cmd=1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 5, in
env.configure(remotes=1) # automatically creates a local docker container
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/timer.py", line 14, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/render.py", line 21, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/throttle.py", line 32, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/envs/vnc_env.py", line 199, in configure
use_recorder_ports=record,
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/build.py", line 19, in build
n=n,
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 44, in init
self._assigner = PortAssigner(reuse=reuse)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 165, in init
self._refresh_ports()
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 169, in _refresh_ports
for container in self.client.containers():
File "/home/shashank/.local/lib/python3.6/site-packages/docker/client.py", line 493, in containers
res = self._result(self._get(u, params=params), True)
File "/home/shashank/.local/lib/python3.6/site-packages/docker/client.py", line 93, in _result
self._raise_for_status(response)
File "/home/shashank/.local/lib/python3.6/site-packages/docker/client.py", line 89, in _raise_for_status
raise errors.APIError(e, response, explanation=explanation)
docker.errors.APIError: 404 Client Error: Not Found ("b'{"message":"page not found"}'")

PLEASE SOMEONE HELP.

@Accessant
Copy link
Author

This is a "the blind leading the blind" answer - to the extent I'm wrong PLEASE correct me.

First, I noticed that you used python 3.6 when universe only supports 3.5. Are you trying to learn to program AI? If so, I recommend...

  1. A lot of OpenAI uses - if not Tensorflow - it uses the syntax of Tensorflow, Google's open source AI suite. The first two places to start is the python programming language if you need a crash course and then Tensorflow. Then install gym and baselines.

  2. This guide helps set up gym and baselines. Be sure to use gym 9.5 if you're using universe. Honestly, I recommend not using universe for now. Universe seems to be a time-independent version of gym - if your program runs at 30 frames per second, gym expects to check in thirty times. Universe can roll without expecting that level of precision.

  3. Install openai baselines. They're the AI suite. For example, copy baselines/deepq/experiments/train_carpole.py and enjoy_carpole.py to your coding directory. Use the first agent to train the AI quickly with the gui turned off, and the second agent to view what was trained. Congrats! You're using AI (with the cartpole environment).

@ShaShekhar
Copy link

@Accessant Thanks for help.

@gdb gdb closed this as completed Apr 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants