Failed to establish a new connection: [Errno 111] Connection refused
See original GitHub issueScenario
I first ran python -m visdom.server
on my laptop. Then I SSHed into the remote server and ran demo.py, but encountered the following ConnectionError. I installed Visdom at both my laptop and the remote server using anaconda.
Error Detail The following error was encountered:
Traceback (most recent call last):
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/util/connection.py", line 83, in create_connection
raise err
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/util/connection.py", line 73, 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/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 356, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 166, in connect
conn = self._new_conn()
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x7f65b3bff780>: 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/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/adapters.py", line 438, in send
timeout=timeout
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/main (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f65b3bff780>: 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/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/visdom/__init__.py", line 446, in _send
data=json.dumps(msg),
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/sessions.py", line 518, in request
resp = self.send(prep, **send_kwargs)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/sessions.py", line 639, in send
r = adapter.send(request, **kwargs)
File "/home/chenzh/anaconda2/envs/py36/lib/python3.6/site-packages/requests/adapters.py", line 502, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/main (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f65b3bff780>: Failed to establish a new connection: [Errno 111] Connection refused',))
The visdom experienced an exception while running: TypeError("check_connection() got an unexpected keyword argument 'timeout_seconds'",)
The demo displays up-to-date functionality with the GitHub version, which may not yet be pushed to pip. Please upgrade using `pip install -e .` or `easy_install .`
If this does not resolve the problem, please open an issue on our GitHub.
Screenshots
Additional context
For SSH, I tried both ssh remote_user@remote_host
and ssh -N -L localhost:8097:localhost:8097 remote_user@remote_host
, but in both ways I found the above error.
Thanks for your time!
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Python - Failed to establish a new connection: [Errno 111 ...
If you're getting "Connection refused", it means there's nothing listening on that port. – AKX. Oct 15, 2021 at 11:46. I triple checked ......
Read more >Failed to establish a new connection: [Errno 111] Connection ...
It looks like to be a network issue. I got the same error 111 when trying to connect to that host via IP...
Read more >Failed to establish a new connection: [Errno 111 ... - GitHub
seems like server is not started successfully. You can check your server by the following 2 steps: restart you server and make sure...
Read more >Faile d to establish a new connection: [Errno 111] in Python
I am trying to upload images with Python (not Django) and I am running this script at PythonAnywhere. I have use this in...
Read more >Re: Failed to establish a new connection: [Errno 111 ... - Dell
Failed to establish a new connection : [Errno 111] Connection refused. Hi all,. Im trying to run a playbook to an Isilon but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you run
python -m visdom.server
In the background on the same machine you run your above snippet on, do you still have the problem?Also once you plan on remotely connecting you’ll have to run
python -m visdom.server
on one machine and then connect to it using the hostname and port arguments forvisdom.Visdom
.@JackUrb So basically I am running the python -m visdom.server and demo.py on two panes of tmux on the server. I first ran python -m visdom.server and then run the demo.py, while it reports the same Connection error. Do you know what is happening?