fossasia / visdom

A flexible tool for creating, organizing, and sharing visualizations of live, rich data. Supports Torch and Numpy.
Apache License 2.0
10k stars 1.14k forks source link

ERROR:root:Error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719) while downloading https://cdn.plot.ly/plotly-latest.min.js #516

Closed Zhenye-Na closed 5 years ago

Zhenye-Na commented 5 years ago

Hi Visdom team,

I have met a problem as follows:

$ visdom
Downloading scripts. It might take a while.
ERROR:root:Error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719) while downloading https://cdn.plot.ly/plotly-latest.min.js
It's Alive!
INFO:root:Application Started
You can navigate to http://localhost:8097

I have been trying upgrade my OpenSSL and other libraries. However, Visdom is not working when I trying to run the given example in the README file, specifically:

import visdom
import numpy as np
vis = visdom.Visdom()
vis.text('Hello, world!')  # this line is working fine
vis.image(np.ones((3, 10, 10))) # this line does not work, no corresponding plot

After running the following scripts in README of this repo, toolbars of Visdom in browser just disappeared.

import visdom
vis = visdom.Visdom()

trace = dict(x=[1, 2, 3], y=[4, 5, 6], mode="markers+lines", type='custom',
             marker={'color': 'red', 'symbol': 104, 'size': "10"},
             text=["one", "two", "three"], name='1st Trace')
layout = dict(title="First Plot", xaxis={'title': 'x1'}, yaxis={'title': 'x2'})

vis._send({'data': [trace], 'layout': layout, 'win': 'mywin'})

I have already tried installing the JavaScript dependency manually. Also, I have tried to install from source. However, I have been searching for visdom tutorial and I found that visdom integrated with matplotlib is working fine except the size of plots cannot be changed dynamically.

I am using Python3 and mac os 10.11

$ python3 -V
Python 3.5.4

similar issue: #251

Thanks in advance!

Best, Zhenye

JackUrb commented 5 years ago

Hi @Zhenye-Na - did you download the dependancies using the download script? The issues that you describe seem to be reminiscent of missing resources. If the overall issue (TLSv1) is still happening it's likely something is still wrong with OpenSSL. What happens if you import ssl and then print the value of ssl.OPENSSL_VERSION?

Zhenye-Na commented 5 years ago

Hi @JackUrb ,

Thanks for replying!

As for the dependancies,

I have tried so far:

  1. pip3 install visdom
  2. pip3 install -e . install from source
  3. download the visdom project folder and run npm etc as mentioned in CONTRIBUTE.md

For OpenSSL issue:

$ python3
Python 3.5.4 (v3.5.4:3f56838976, Aug  7 2017, 12:56:33)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> print(ssl.OPENSSL_VERSION)
OpenSSL 0.9.8zh 14 Jan 2016
>>>

I have tried brew upgrade openssl and it turned out some error which is not upgraded successfully.

$ brew upgrade openssl
==> Upgrading 1 outdated package:
openssl 1.0.2p -> 1.0.2q
==> Upgrading openssl
JackUrb commented 5 years ago

After pulling the source you should be able to just run the ./download.sh script to pull the server requirements using wget rather than python.

For openssl you may need to update brew first. I can't further debug on my end but maybe this answer will prove helpful?

Zhenye-Na commented 5 years ago

I ran the download.sh script using wget. It seems like two files are not downloaded correctly (?) based on the log below:

--2018-11-28 16:54:49--  https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_SVG
Resolving cdnjs.cloudflare.com (cdnjs.cloudflare.com)... 104.19.197.151, 104.19.195.151, 104.19.196.151, ...
Connecting to cdnjs.cloudflare.com (cdnjs.cloudflare.com)|104.19.197.151|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/javascript]
Saving to: ‘py/static/js/mathjax-MathJax.js’

py/static/js/mathjax     [ <=>                ]  61.57K  --.-KB/s    in 0.01s

2018-11-28 16:54:50 (5.07 MB/s) - ‘py/static/js/mathjax-MathJax.js’ saved [63048]

--2018-11-28 16:54:50--  https://cdn.rawgit.com/plotly/plotly.js/master/dist/plotly.min.js
Resolving cdn.rawgit.com (cdn.rawgit.com)... 151.139.237.11
Connecting to cdn.rawgit.com (cdn.rawgit.com)|151.139.237.11|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/javascript]
Saving to: ‘py/static/js/plotly-plotly.min.js’

py/static/js/plotly-     [    <=>             ]   2.74M  3.58MB/s    in 0.8s

Besides, installing wget need openssl so openssl seems to upgrade successfully.

$ openssl version
OpenSSL 0.9.8zh 14 Jan 2016
$ brew upgrade openssl
Error: openssl 1.0.2q already installed

However,

$ python3
Python 3.5.4 (v3.5.4:3f56838976, Aug  7 2017, 12:56:33)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> print(ssl.OPENSSL_VERSION)
OpenSSL 0.9.8zh 14 Jan 2016
>>>

Any observations?

JackUrb commented 5 years ago

Seems something isn't linked properly, seeing openssl version return OpenSSL 0.9.8zh when upgrading tells you openssl 1.0.2q already installed tells me you have openssl installed in two locations. Your $PATH is probably pointing to the old one (which openssl). What's the output of which python and which openssl, as well as brew info openssl?

Zhenye-Na commented 5 years ago

Here are the outputs of which python and which openssl, as well as brew info openssl

$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ which python3
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
$ which openssl
/usr/bin/openssl
$ brew info openssl
openssl: stable 1.0.2q [keg-only]
SSL/TLS cryptography library
https://openssl.org/
/usr/local/Cellar/openssl/1.0.2p (1,793 files, 12.2MB)
  Poured from bottle on 2018-09-16 at 00:58:33
/usr/local/Cellar/openssl/1.0.2q (1,786 files, 12.1MB)
  Built from source on 2018-11-28 at 16:49:10
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl.rb
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

==> Analytics
install: 462,158 (30 days), 1,437,603 (90 days), 5,873,213 (365 days)
install_on_request: 61,379 (30 days), 190,015 (90 days), 782,106 (365 days)
build_error: 0 (30 days)

It seems that openssl is wrongly pointed, am I right?

JackUrb commented 5 years ago

Definitely the case.

Seems you're using the default locations for python, while brew code is ending up in local for your own personal builds. You'll need to use python installed with brew and change the location from where python runs to point to brew's version. It starts with brew install python but I really don't know the steps from that point.

Zhenye-Na commented 5 years ago

Thanks for your help! Will figure out how to re-link to the correct version of openssl.

JackUrb commented 5 years ago

Closing as ultimately this isn't a visdom issue