关于gym和universe安装

来源:7-4 配置开发环境(2)

小菠萝萝

2018-05-18

按照老师简书上的内容,卸载了gym(0.10.5版本),然后 pip install gym==0.9.5

然后再去运行test_universe1.py 又报错了,

[2018-05-18 14:44:15,050] Making new env: gym-core.PongDeterministic-v0

[2018-05-18 14:44:15,235] Writing logs to file: /tmp/universe-13728.log

Traceback (most recent call last):

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 578, in urlopen

    chunked=chunked)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 362, in _make_request

    conn.request(method, url, **httplib_request_kw)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 1107, in request

    self._send_request(method, url, body, headers)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 1152, in _send_request

    self.endheaders(body)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 1103, in endheaders

    self._send_output(message_body)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 934, in _send_output

    self.send(msg)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 877, in send

    self.connect()

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/docker/transport/unixconn.py", line 33, in connect

    sock.connect(self.unix_socket)

PermissionError: [Errno 13] Permission denied


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/adapters.py", line 403, in send

    timeout=timeout

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 623, in urlopen

    _stacktrace=sys.exc_info()[2])

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/packages/urllib3/util/retry.py", line 255, in increment

    raise six.reraise(type(error), error, _stacktrace)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/packages/urllib3/packages/six.py", line 309, in reraise

    raise value.with_traceback(tb)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 578, in urlopen

    chunked=chunked)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 362, in _make_request

    conn.request(method, url, **httplib_request_kw)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 1107, in request

    self._send_request(method, url, body, headers)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 1152, in _send_request

    self.endheaders(body)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 1103, in endheaders

    self._send_output(message_body)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 934, in _send_output

    self.send(msg)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/http/client.py", line 877, in send

    self.connect()

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/docker/transport/unixconn.py", line 33, in connect

    sock.connect(self.unix_socket)

requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/docker/client.py", line 116, in _retrieve_server_version

    return self.version(api_version=False)["ApiVersion"]

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/docker/api/daemon.py", line 76, in version

    return self._result(self._get(url), json=True)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/docker/utils/decorators.py", line 47, in inner

    return f(self, *args, **kwargs)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/docker/client.py", line 139, in _get

    return self.get(url, **self._set_request_timeout(kwargs))

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/sessions.py", line 487, in get

    return self.request('GET', url, **kwargs)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/sessions.py", line 475, in request

    resp = self.send(prep, **send_kwargs)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/sessions.py", line 585, in send

    r = adapter.send(request, **kwargs)

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/requests/adapters.py", line 453, in send

    raise ConnectionError(err, request=request)

requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/yinlei/pyprojects/AI_imooc/test/test_universe1.py", line 7, in <module>

    env.configure(remotes=1)

  File "/home/yinlei/universe/universe/vectorized/core.py", line 44, in configure

    self.env.configure(**kwargs)

  File "/home/yinlei/universe/universe/wrappers/timer.py", line 14, in configure

    self.env.configure(**kwargs)

  File "/home/yinlei/universe/universe/wrappers/render.py", line 21, in configure

    self.env.configure(**kwargs)

  File "/home/yinlei/universe/universe/wrappers/throttle.py", line 32, in configure

    self.env.configure(**kwargs)

  File "/home/yinlei/universe/universe/envs/vnc_env.py", line 199, in configure

    use_recorder_ports=record,

  File "/home/yinlei/universe/universe/remotes/build.py", line 19, in build

    n=n,

  File "/home/yinlei/universe/universe/remotes/docker_remote.py", line 44, in __init__

    self._assigner = PortAssigner(reuse=reuse)

  File "/home/yinlei/universe/universe/remotes/docker_remote.py", line 163, in __init__

    self.client, self.info = get_client()

  File "/home/yinlei/universe/universe/remotes/docker_remote.py", line 157, in get_client

    return docker.Client(base_url=host, version=client_api_version), info

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-packages/docker/client.py", line 99, in __init__

    self._version = self._retrieve_server_version()

  File "/home/yinlei/anaconda3/envs/py35/lib/python3.5/site-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.', PermissionError(13, 'Permission denied'))


写回答

1回答

Oscar

2018-05-18

你的 Docker 没设置非 root 用户也可以运行吧?因为我在上面的错误里看到了 Permission Denied(权限被否决)

为了让我们之后每次运行 Docker 不需要用 root 身份而只需要用我们的普通用户身份,我们可以这样做:

sudo groupadd docker

上面的命令是为了创建一个用户组,叫做 docker。

然后,我们再把我们当前所在的用户添加到 docker 这个用户组里:

sudo usermod -aG docker $USER

接着,重启一下电脑:

sudo reboot
0
0

基于Python玩转人工智能最火框架 TensorFlow应用实践

机器学习入门,打牢TensorFlow框架应用是关键!

2214 学习 · 688 问题

查看课程