My visdom.server runs when I do python -m visdom.server.
However, when I try to run python example/demo.py, I get the following error
error from callback
Python 3.6, Websocket-client 0.47.0 and latest Visdom from the git repo.
Hi @ashwink-40 - can you replace the contents of this function:
https://github.com/facebookresearch/visdom/blob/c5cd6bb5cd82c4b71143527700e02f330316a764/py/__init__.py#L282
With the following?
def on_error(ws, error):
try:
if error.errno == errno.ECONNREFUSED:
logger.info("Socket refused connection, running socketless")
ws.close()
self.use_socket = False
else:
logger.error(error)
except BaseException:
print('Socket had unexpected error type: {}'
''.format(repr(error)))
Then try running again and let me know what the output is? I wasn't expecting a WebSocketProxyException at this point in the code so I'd need to know the cause to figure out how to best handle it.
@JackUrb can I contribute?
@anu0012 Of course! We are regularly accepting pull requests.
Hey @JackUrb I am getting following error after replacing with your code.
The visdom experienced an exception while running: AssertionError('No connection could be formed quickly',) 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.
Hi @anu0012 - can you set startup_sec (line 25 of demo.py) to something larger (like 30?)
Hi @JackUrb
Sorry for the late response.
I get this at the output
python example/demo.py
Socket had error name 'on_close' is not defined, attempting restart
Socket had error name 'on_close' is not defined, attempting restart
Socket had error name 'on_close' is not defined, attempting restart
Socket had error name 'on_close' is not defined, attempting restart
Socket had error name 'on_close' is not defined, attempting restart
@ashwink-40 what version of python are you running visdom with? The on_close function is defined shortly before the location that the error call is happening, so I'm not positive how it would think it's not defined.
https://github.com/facebookresearch/visdom/blob/ed67b7c26769d94f0e3e9071293569995e4ccc55/py/__init__.py#L292
Python 3.6.4 (Anaconda)
If you were to add a log to see if on_close existed right before the socket is launched, what do you see printed?
So I get this error
Socket had unexpected error type: WebSocketProxyException('failed CONNECT via proxy status: 403',)
The visdom.server is running on localhost:8097.
However, the machine (VM running Ubuntu 12.04) requires explicit http_proxy setting. I have exported it in my shell. This looks like to be the problem.
I tried specifying the http_proxy_host, but it doesn't work.
Ah okay proxy settings could definitely be the problem. I hadn't tested the socket connection over required proxies, but there is definitely a way this could be done.
Websocket exposes parameters for setting up proxies:
https://github.com/websocket-client/websocket-client#http-proxy
Those same parameters can be provided to the websocket app during startup:
https://github.com/websocket-client/websocket-client/blob/87861f951d1a65ed5d9080f7aaaf44310f376c56/websocket/_app.py#L171
I would be happy to accept a PR that pulls the http_proxy setting from your environment and/or from the proxy settings passed in and puts it in here, and it would likely solve your problem.