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

ConnectionRefusedError #16

Open
AOoligei opened this issue Apr 4, 2020 · 5 comments
Open

ConnectionRefusedError #16

AOoligei opened this issue Apr 4, 2020 · 5 comments

Comments

@AOoligei
Copy link

AOoligei commented Apr 4, 2020

当我运行时,会出现
`------------------------------------------------------------
/home/clb/anaconda3/envs/tensorflow/bin/python /home/clb/桌面/pytorch-maddpg-master/main.py
Setting up a new session...
Exception in user code:

Traceback (most recent call last):
F`/home/clb/anaconda3/envs/tensorflow/bin/python /home/clb/桌面/pytorch-maddpg-master/main.py
Setting up a new session...
Exception in user code:ile "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1262, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1308, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1257, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1036, in _send_output
self.send(msg)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 974, in send
self.connect()
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 189, in connect
conn = self._new_conn()
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 171, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fd2d59caf60>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py", line 725, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/util/retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=5274): Max retries exceeded with url: /env/main (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd2d59caf60>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/visdom/init.py", line 711, in _send
data=json.dumps(msg),
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/visdom/init.py", line 677, in _handle_post
r = self.session.post(url, data=data)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/sessions.py", line 578, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5274): Max retries exceeded with url: /env/main (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd2d59caf60>: Failed to establish a new connection: [Errno 111] Connection refused',))
[Errno 111] Connection refused
/home/clb/.local/lib/python3.6/site-packages/torch/nn/functional.py:1340: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead.
warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
Episode: 0, reward = -78.971497
Exception in user code:

Exception in user code:

Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1262, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1308, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1257, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1036, in _send_output
self.send(msg)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 974, in send
self.connect()
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 189, in connect
conn = self._new_conn()
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 171, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fd2819846d8>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py", line 725, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/util/retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=5274): Max retries exceeded with url: /events (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd2819846d8>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/visdom/init.py", line 711, in _send
data=json.dumps(msg),
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/visdom/init.py", line 677, in _handle_post
r = self.session.post(url, data=data)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/sessions.py", line 578, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5274): Max retries exceeded with url: /events (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd2819846d8>: Failed to establish a new connection: [Errno 111] Connection refused',))
Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1262, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1308, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1257, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 1036, in _send_output
self.send(msg)
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/http/client.py", line 974, in send
self.connect()
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 189, in connect
conn = self._new_conn()
File "/home/clb/anaconda3/envs/tensorflow/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connection.py", line 171, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fd281984a58>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:`

就像这样,一边运行一边报错,最后不再运行。请问该怎么解决。

@xuehy
Copy link
Owner

xuehy commented Apr 5, 2020

Install visdom and start a visdom server by visdom -port 5274

@AOoligei
Copy link
Author

AOoligei commented Apr 5, 2020

Anothon question.当我运行到100时,
Episode: 96, reward = -90.833405 Episode: 97, reward = -82.624748 Episode: 98, reward = -79.773178 Episode: 99, reward = -82.121429 training now begins... MADDPG on WaterWorld scale_reward=0.010000 agent=2, coop=2 lr=0.001, 0.0001, sensor_range=0.3 food=10.000000, poison=-1.000000, encounter=0.010000 Episode: 100, reward = -93.504677 /pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. /pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. /pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. /pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. /pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. /pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. /pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. /pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.

一边运行一边报/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.

这个需要把哪个变量转为# convert int8 to bool 才是正确的?

@xuehy
Copy link
Owner

xuehy commented Apr 6, 2020

I guess it's non_final_mask. Line 77 in MADDPG.py

@AOoligei
Copy link
Author

AOoligei commented Apr 7, 2020

I fixed this warning by changing objects of type ByteTensor to BoolTensor instead. This was the source of the warnings for me.

@AOoligei AOoligei closed this as completed Apr 7, 2020
@AOoligei
Copy link
Author

AOoligei commented Apr 7, 2020

Hello, I can't get the result in the picture(All the agents are on the side). How did you set the parameters to get the result in the PNG(demo.gif)?

@AOoligei AOoligei reopened this Apr 7, 2020
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

No branches or pull requests

2 participants