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

Connection timed out : when using python -m visdom.server #185

Closed
huoliangyu opened this issue Oct 29, 2017 · 18 comments
Closed

Connection timed out : when using python -m visdom.server #185

huoliangyu opened this issue Oct 29, 2017 · 18 comments

Comments

@huoliangyu
Copy link

Hi, when I use
python -m visdom.server
to start visdom server, I got Connection timed out error as following:
`Traceback (most recent call last):
File "/root/anaconda2/envs/gtn_env/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/root/anaconda2/envs/gtn_env/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/root/anaconda2/envs/gtn_env/lib/python3.6/http/client.py", line 1392, in connect
super().connect()
File "/root/anaconda2/envs/gtn_env/lib/python3.6/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/socket.py", line 722, in create_connection
raise err
File "/root/anaconda2/envs/gtn_env/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/anaconda2/envs/gtn_env/lib/python3.6/site-packages/visdom/server.py", line 615, in download_scripts
data = opener.open(req).read()
File "/root/anaconda2/envs/gtn_env/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 110] Connection timed out>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/anaconda2/envs/gtn_env/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/anaconda2/envs/gtn_env/lib/python3.6/site-packages/visdom/server.py", line 636, in
download_scripts()
File "/root/anaconda2/envs/gtn_env/lib/python3.6/site-packages/visdom/server.py", line 619, in download_scripts
logging.error('Error {} while downloading {}'.format(exc.code, key))
AttributeError: 'URLError' object has no attribute 'code'
`
I am a new one for pytorch and visdom. I would like to use visdom for visualization. I use anaconda2, python3.6 as default setting. What should I do? Thanks a lot !

@lvdmaaten
Copy link
Contributor

Visdom downloads some external JS dependencies at server start-up time. It looks like those downloads fail for you. Do you need a proxy to be able to access public URLs from your machine?

@huoliangyu
Copy link
Author

Thanks for your suggestion . However, It seems that I don' t need a proxy, since another machine is able to run the visdom server normally with the same Internet setting as mine. Is there any possible for other problems ? Thanks a lot.

@JackUrb
Copy link
Contributor

JackUrb commented Oct 30, 2017

Still, if your urllib module is up to date it would seem at least one of the packages must be failing, though it's hard to say which one. Can you list the contents of your /root/anaconda2/envs/gtn_env/lib/python3.6/site-packages/visdom/static directory and sub directories?

@huoliangyu
Copy link
Author

Thanks for reply. The directory "............../static" contains :
css fonts index.html js
The directory "............../static/js" contains:
bootstrap.min.js jquery.min.js main.js react-dom.min.js react-react.min.js
Does it help ?

@JackUrb
Copy link
Contributor

JackUrb commented Oct 30, 2017

Is there anything at all in fonts or css? If not it would appear the first thing missing in the order of things downloaded belongs in the font folder, namely the script downloaded by visdom from https://unpkg.com/classnames@2.2.5 and stored as visdom/static/fonts/classnames. If nothing is in your fonts directory can you download that file manually, save it as classnames, and put it in the static/fonts directory before continuing? Then see if more files populate?

@huoliangyu
Copy link
Author

huoliangyu commented Oct 30, 2017

I have checked the static/fonts directory. It contains:
classnames layout_bin_packer
In "classnames" , it is commented at top as following:

Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames

I am not sure if it is dowloaded from https://unpkg.com/classnames@2.2.5.
Do I still need to download that file manually as you say ?

@JackUrb
Copy link
Contributor

JackUrb commented Oct 30, 2017

No that's the correct file. It seems all the unpkg.com files from the first batch download then. Based on what you've listed the first file you're getting stuck on is https://cdn.rawgit.com/STRML/react-grid-layout/0.14.0/dist/react-grid-layout.min.js, which should be saved as visdom/static/js/react-grid-layout.min.js. Do you have this file?

@huoliangyu
Copy link
Author

NO, I don' t have this file. So I need to dowload this file manually, from https://cdn.rawgit.com/STRML/react-grid-layout/0.14.0/dist/react-grid-layout.min.js and save it as visdom/static/js/react-grid-layout.min.js. Is that correct?

@JackUrb
Copy link
Contributor

JackUrb commented Oct 30, 2017

Correct, then try to start the server again and see if it makes it to running. In general as you run into problems with CDNs, the order that visdom downloads and saves files is as follows:

download from https://unpkg.com/jquery@3.1.1/dist/jquery.min.js 
   and put at visdom/static/js/jquery.min.js
download from https://unpkg.com/bootstrap@3.3.7/dist/js/bootstrap.min.js 
   and put at visdom/static/js/bootstrap.min.js
download from https://unpkg.com/react-resizable@1.4.6/css/styles.css 
   and put at visdom/static/css/react-resizable-styles.css
download from https://unpkg.com/react-grid-layout@0.14.0/css/styles.css
   and put at visdom/static/css/react-grid-layout-styles.css
download from https://unpkg.com/react@15.6.1/dist/react.min.js
   and put at visdom/static/js/react-react.min.js
download from https://unpkg.com/react-dom@15.6.1/dist/react-dom.min.js 
   and put at visdom/static/js/react-dom.min.js
download from https://unpkg.com/classnames@2.2.5 
   and put at visdom/static/fonts/classnames
download from https://unpkg.com/layout-bin-packer@1.2.2 
   and put at visdom/static/fonts/layout_bin_packer
download from https://cdn.rawgit.com/STRML/react-grid-layout/0.14.0/dist/react-grid-layout.min.js 
   and put at visdom/static/js/react-grid-layout.min.js
download from https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG 
   and put at visdom/static/js/mathjax-MathJax.js
download from https://cdn.rawgit.com/plotly/plotly.js/master/dist/plotly.min.js 
   and put at visdom/static/js/plotly-plotly.min.js
download from https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css 
   and put at visdom/static/css/bootstrap.min.css
download from https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.eot 
   and put at visdom/static/fonts/glyphicons-halflings-regular.eot
download from https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.eot?#iefix 
   and put at visdom/static/fonts/glyphicons-halflings-regular.eot?#iefix
download from https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.woff2 
   and put at visdom/static/fonts/glyphicons-halflings-regular.woff2
download from https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.woff 
   and put at visdom/static/fonts/glyphicons-halflings-regular.woff
download from https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.ttf 
   and put at visdom/static/fonts/glyphicons-halflings-regular.ttf
download from https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular 
   and put at visdom/static/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular

If you run the server and it hangs on downloading, you can download the next missing file yourself (based on the last file in the list you can confirm having)

@huoliangyu
Copy link
Author

It works for me. Thank you very much !

@ksnzh
Copy link

ksnzh commented Nov 1, 2017

@JackUrb How to download https://unpkg.com/classnames@2.2.5? Is this a file?
https://unpkg.com/classnames@2.2.5/index.js?

@ksnzh
Copy link

ksnzh commented Nov 1, 2017

@JackUrb Yes, it's a js file. And following your instructions, I solved this problem. Thank you very much.

@AndrewZhao
Copy link

AndrewZhao commented Nov 4, 2017

@huoliangyu @JackUrb @ksnzh
hello,this link https://cdn.rawgit.com/STRML/react-grid-layout/0.14.0/dist/react-grid-layout.min.js seems have some errors. Can you share me all of the files in visdom/static? Thanks very much!
My Email address is zhaoboya@bit.edu.cn

@xiaofengqing
Copy link

@AndrewZhao Can you share me all of the files in visdom/static? Thanks very much!
My Email address is 674868552@qq.com

@logic1988
Copy link

logic1988 commented Dec 4, 2017

Thank @JackUrb . I changed the download link to a shell command with a text replacement:

wget https://unpkg.com/jquery@3.1.1/dist/jquery.min.js -O visdom/static/js/jquery.min.js
wget https://unpkg.com/bootstrap@3.3.7/dist/js/bootstrap.min.js -O visdom/static/js/bootstrap.min.js
wget https://unpkg.com/react-resizable@1.4.6/css/styles.css -O visdom/static/css/react-resizable-styles.css
wget https://unpkg.com/react-grid-layout@0.14.0/css/styles.css
   and put at visdom/static/css/react-grid-layout-styles.css
wget https://unpkg.com/react@15.6.1/dist/react.min.js
   and put at visdom/static/js/react-react.min.js
wget https://unpkg.com/react-dom@15.6.1/dist/react-dom.min.js -O visdom/static/js/react-dom.min.js
wget https://unpkg.com/classnames@2.2.5 -O visdom/static/fonts/classnames
wget https://unpkg.com/layout-bin-packer@1.2.2 -O visdom/static/fonts/layout_bin_packer
wget https://cdn.rawgit.com/STRML/react-grid-layout/0.14.0/dist/react-grid-layout.min.js -O visdom/static/js/react-grid-layout.min.js
wget https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG -O visdom/static/js/mathjax-MathJax.js
wget https://cdn.rawgit.com/plotly/plotly.js/master/dist/plotly.min.js -O visdom/static/js/plotly-plotly.min.js
wget https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css -O visdom/static/css/bootstrap.min.css
wget https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.eot -O visdom/static/fonts/glyphicons-halflings-regular.eot
wget https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.eot?#iefix -O visdom/static/fonts/glyphicons-halflings-regular.eot?#iefix
wget https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.woff2 -O visdom/static/fonts/glyphicons-halflings-regular.woff2
wget https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.woff -O visdom/static/fonts/glyphicons-halflings-regular.woff
wget https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.ttf -O visdom/static/fonts/glyphicons-halflings-regular.ttf
wget https://unpkg.com/bootstrap@3.3.7/dist/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular -O visdom/static/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular

@JackUrb
Copy link
Contributor

JackUrb commented Dec 4, 2017

@logic1988 thanks for the suggested conversion - I'll update the docs with this (as in the best case it automates the download and in the worst case if someone can't wget through their proxy it's no worse than the copy-paste it was before)

JackUrb added a commit that referenced this issue Dec 5, 2017
Using instructions formatted as a terminal command for simple copy-paste in cases where wget works through the proxy. Worst case users still need to copy and paste, but best case this takes care of all that.

Found in #185 (comment)
facebook-github-bot pushed a commit that referenced this issue Dec 6, 2017
Summary:
Using instructions formatted as a terminal command for simple copy-paste in cases where wget works through the proxy. Worst case users still need to copy and paste, but best case this takes care of all that.

Found in #185 (comment)
Closes #216

Differential Revision: D6497957

Pulled By: JackUrb

fbshipit-source-id: e4e7fc52e9831be646a165fcdcec4bc057376c94
@sergeywong
Copy link

I meet the same problem. It is stuck at downloading the file visdom/static/js/react-grid-layout.min.js from the link https://cdn.rawgit.com/STRML/react-grid-layout/0.14.0/dist/react-grid-layout.min.js. The problem occurs in the version 0.1.6 of visdom. The problem is resolved with the version 0.1.5.

@JackUrb
Copy link
Contributor

JackUrb commented Dec 18, 2017

Hi @sergeywong - a fix for this was added to the github recently and I just pushed it to pypi. Try using version 0.1.6.5

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

8 participants