我正在玩OpenAI的宇宙,当我点击运行时,它会出现错误。
当前脚本:
import gym
import universe # register the universe environments
env = gym.make('flashgames.CoasterRacer-v0')
observation_n = env.reset()
如果我删除了observation_n变量,它就不会出现错误。使用observation_n会导致错误。现在我正在运行docker-py (1.10.3)
。
[2016-12-11 18:32:12,128] Making new env: flashgames.CoasterRacer-v0
[2016-12-11 18:32:12,132] Writing logs to file: /tmp/universe-10547.log
Traceback (most recent call last):
File "/home/ubuntu/workspace/gim.py", line 5, in <module>
observation_n = env.reset()
File "/home/ubuntu/workspace/gym/gym/core.py", line 137, in reset
self.configure()
File "/home/ubuntu/workspace/gym/gym/core.py", line 246, in configure
self._configure(*args, **kwargs)
File "/home/ubuntu/workspace/universe/universe/vectorized/core.py", line 57, in _configure
super(Wrapper, self)._configure(**kwargs)
File "/home/ubuntu/workspace/gym/gym/core.py", line 350, in _configure
return self.env.configure(*args, **kwargs)
File "/home/ubuntu/workspace/gym/gym/core.py", line 246, in configure
self._configure(*args, **kwargs)
File "/home/ubuntu/workspace/universe/universe/wrappers/render.py", line 18, in _configure
super(Render, self)._configure(**kwargs)
File "/home/ubuntu/workspace/universe/universe/vectorized/core.py", line 57, in _configure
super(Wrapper, self)._configure(**kwargs)
File "/home/ubuntu/workspace/gym/gym/core.py", line 350, in _configure
return self.env.configure(*args, **kwargs)
File "/home/ubuntu/workspace/gym/gym/core.py", line 246, in configure
self._configure(*args, **kwargs)
File "/home/ubuntu/workspace/universe/universe/wrappers/throttle.py", line 27, in _configure
super(Throttle, self)._configure(**kwargs)
File "/home/ubuntu/workspace/universe/universe/vectorized/core.py", line 57, in _configure
super(Wrapper, self)._configure(**kwargs)
File "/home/ubuntu/workspace/gym/gym/core.py", line 350, in _configure
File "/home/ubuntu/workspace/gym/gym/core.py", line 246, in configure
self._configure(*args, **kwargs)
File "/home/ubuntu/workspace/universe/universe/envs/vnc_env.py", line 192, in _configure
api_key=api_key,
File "/home/ubuntu/workspace/universe/universe/remotes/build.py", line 19, in build
n=n,
File "/home/ubuntu/workspace/universe/universe/remotes/docker_remote.py", line 43, in __init__
self._assigner = PortAssigner(reuse=reuse)
File "/home/ubuntu/workspace/universe/universe/remotes/docker_remote.py", line 149, in __init__
self.client, self.info = get_client()
File "/home/ubuntu/workspace/universe/universe/remotes/docker_remote.py", line 143, in get_client
return docker.Client(base_url=host, version=client_api_version), info
File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 99, in __init__
self._version = self._retrieve_server_version()
File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 124, in _retrieve_server_version
'Error while fetching server API version: {0}'.format(e)
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))
答案 0 :(得分:3)
在你的程序中,在gym.make之后添加一行,如下所示,
env = gym.make('flashgames.DuskDrive-v0')
env.configure(remotes="vnc://localhost:5900+15901")
observation_n = env.reset()
保存。 现在打开两个终端窗口。在第一种类型中,
sudo docker run -p 5900:5900 -p 15901:15901 --privileged --cap-add SYS_ADMIN --ipc host quay.io/openai/universe.flashgames:0.20.7
一些胡言乱语将开始出现。现在直到那件事情发生,在下一个窗口中,您将使用命令
打开您的anaconda环境source activate universe
然后运行你的python代码,python“path_name”/“program_name”.py
有关完整指南,请参阅此链接 -
https://alliseesolutions.wordpress.com/2016/12/08/openai-universe-installation-guide-ubuntu-16-04/ https://medium.com/@alexbhandari/openai-universe-getting-started-on-mac-52d601ef9161#.p8njfuqff