twosigma / beakerx

Beaker Extensions for Jupyter Notebook
http://BeakerX.com
Apache License 2.0
2.8k stars 381 forks source link

Vertical lines on TimePlot broken in python #8015

Open feribg opened 5 years ago

feribg commented 5 years ago

The following code and variations of it produce a blank chart

y = pd.Series([7.5, 7.9, 7, 8.7, 8, 8.5])
dates = pd.Series(['2015-02-01',
                   '2015-02-02',
                   '2015-02-03',
                   '2015-02-04',
                   '2015-02-05',
                   '2015-02-06']
                  , dtype='datetime64[ns]')
plot = TimePlot()
plot.add(Line(x=dates, y=y))
plot.add(ConstantLine(x=pd.to_datetime('2015-02-04 15:00:00'))

If I switch to using nanoseconds as keys instead of Timestamp then it works as expected. I'm attaching a couple of screenshots of the chart and the log with the error. I'm not even sure how to get to the backend log of beakerX in order to see what's the root exception, any direction would be very helpful.

Screen Shot 2019-03-22 at 6 55 47 PM Screen Shot 2019-03-22 at 6 53 21 PM
tschm commented 5 years ago

I guess you have installed beakerx via pip rather than using the beakerx Docker container. Using Docker this works without problems. Just try docker run -p 8888:8888 beakerx/beakerx and run your code in a notebook. It will work. I had the same issue you have observed while trying to install beakerx in a container from the Jupyter family...

feribg commented 5 years ago

That's surprising, I installed it via conda actually and using it in jupyter lab. Sadly docker is a no go for me. Do you know the root cause for this and what would be the difference between the docker version and the conda version. Could it also be because of using jupyter lab instead of notebook.

tschm commented 5 years ago

Yes, I tried with conda into a Jupyter container, too. Won't work either. I don't know enough about JavaScript to drill into such isssues. I stick to the Docker container. Do yourself a favor :-) You have Jupyter in the beaker container :-) It's much easier using their prebuilt Docker containers...

tschm commented 5 years ago

You may want to check #8003 :-)

feribg commented 5 years ago

You may want to check #8003 :-)

Just out of curiousity whats the jupyter lab and beakerX version you see reported in your docker image? I have a feeling it's a version issue not so much an environment thing, because I had a peak at the Dockerfile and env setup and nothing stands out, it's basically a conda install of beakerx, ipywidget and jupyter, pretty much what i'm doing.

The workaround in the ticket works, using integers, but it's terrible from a usability standpoint, since they carry little meaning to a human observer.

tschm commented 5 years ago

Here's my conda list within the container:

# Name                    Version                   Build  Channel
alembic                   0.9.9                      py_0    conda-forge
asn1crypto                0.24.0                   py36_0    conda-forge
attrs                     18.1.0                     py_0    conda-forge
backcall                  0.1.0                      py_0    conda-forge
beakerx                   1.0.0                     dev_0    <develop>
bleach                    2.1.3                      py_0    conda-forge
ca-certificates           2019.3.9             hecc5488_0    conda-forge
certifi                   2019.3.9                 py36_0    conda-forge
cffi                      1.11.5                   py36_0    conda-forge
chardet                   3.0.4                    py36_0    conda-forge
configurable-http-proxy   3.1.0                   node8_1    conda-forge
cryptography              2.6.1            py36h9d9f1b6_0    conda-forge
cvxpy                     1.0.14           py36hf484d3e_0    conda-forge
cvxpy-base                1.0.14           py36hf484d3e_0    conda-forge
decorator                 4.3.0                      py_0    conda-forge
dill                      0.2.9                    py36_0    conda-forge
ecos                      2.0.7           py36h3010b51_1000    conda-forge
entrypoints               0.2.3                    py36_1    conda-forge
fastcache                 1.0.2           py36h14c3975_1001    conda-forge
fontconfig                2.13.1            he4413a7_1000    conda-forge
freetype                  2.10.0               he983fc9_0    conda-forge
future                    0.17.1                py36_1000    conda-forge
gmp                       6.1.2                         0    conda-forge
html5lib                  1.0.1                      py_0    conda-forge
icu                       58.2              hf484d3e_1000    conda-forge
idna                      2.6                      py36_1    conda-forge
intel-openmp              2018.0.0                      8  
ipykernel                 4.8.2                    py36_0    conda-forge
ipython                   6.4.0                    py36_0    conda-forge
ipython_genutils          0.2.0                    py36_0    conda-forge
ipywidgets                7.2.1                    py36_1    conda-forge
jedi                      0.12.0                   py36_0    conda-forge
jinja2                    2.10                     py36_0    conda-forge
jsonschema                2.6.0                    py36_1    conda-forge
jupyter                   1.0.0                      py_1    conda-forge
jupyter_client            5.2.3                    py36_0    conda-forge
jupyter_console           5.2.0                    py36_1    conda-forge
jupyter_core              4.4.0                      py_0    conda-forge
jupyterhub                0.8.1                    py36_0    conda-forge
jupyterlab                0.32.1                   py36_0    conda-forge
jupyterlab_launcher       0.10.5                   py36_0    conda-forge
libblas                   3.8.0                4_openblas    conda-forge
libcblas                  3.8.0                4_openblas    conda-forge
libedit                   3.1.20170329         h6b74fdf_2  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 8.2.0                hdf63c60_1  
libgfortran-ng            7.2.0                hdf63c60_3  
libiconv                  1.15              h516909a_1005    conda-forge
liblapack                 3.8.0                4_openblas    conda-forge
libpng                    1.6.36            h84994c4_1000    conda-forge
libsodium                 1.0.16                        0    conda-forge
libstdcxx-ng              8.2.0                hdf63c60_1  
libuuid                   2.32.1            h14c3975_1000    conda-forge
libxml2                   2.9.8             h143f9aa_1005    conda-forge
mako                      1.0.7                    pypi_0    pypi
markupsafe                1.0                      py36_0    conda-forge
maven                     3.5.0                         0  
mistune                   0.8.3                    py36_1    conda-forge
mkl                       2018.0.2                      1  
mkl_fft                   1.0.1            py36h3010b51_0  
mkl_random                1.0.1            py36h629b387_0  
more-itertools            4.1.0                      py_0    conda-forge
multiprocess              0.70.7           py36h14c3975_0    conda-forge
nbconvert                 5.3.1                      py_1    conda-forge
nbformat                  4.4.0                    py36_0    conda-forge
ncurses                   6.1                  hf484d3e_0  
nodejs                    8.11.1               hf484d3e_0  
notebook                  5.5.0                    py36_0    conda-forge
numpy                     1.16.2           py36h8b7e671_1    conda-forge
openblas                  0.3.5             h9ac9557_1001    conda-forge
openjdk                   8.0.152              h46b5887_1  
openssl                   1.1.1b               h14c3975_1    conda-forge
osqp                      0.4.1           py36h637b7d7_1001    conda-forge
pamela                    0.3.0                    py36_0    conda-forge
pandas                    0.24.1           py36hf484d3e_0    conda-forge
pandoc                    2.2.1                         0    conda-forge
pandocfilters             1.4.2                    py36_0    conda-forge
parso                     0.2.0                      py_0    conda-forge
pexpect                   4.5.0                    py36_0    conda-forge
pickleshare               0.7.4                    py36_0    conda-forge
pip                       19.0.3                   pypi_0    pypi
pluggy                    0.6.0                      py_0    conda-forge
prompt_toolkit            1.0.15                   py36_0    conda-forge
ptyprocess                0.5.2                    py36_0    conda-forge
py                        1.5.3                      py_0    conda-forge
py4j                      0.10.7                   py36_0  
pycparser                 2.18                     py36_0    conda-forge
pygments                  2.2.0                    py36_0    conda-forge
pyopenssl                 18.0.0                   py36_0    conda-forge
pyqt                      4.11.4                   py36_3    conda-forge
pysocks                   1.6.8                    py36_1    conda-forge
pytest                    3.5.1                    py36_0    conda-forge
python                    3.6.7             h381d211_1004    conda-forge
python-dateutil           2.7.3                    py36_0  
python-editor             1.0.3                    py36_0    conda-forge
python-oauth2             1.0.1                    py36_0    conda-forge
pytz                      2018.4                   py36_0  
pyzmq                     17.0.0                   py36_4    conda-forge
qt                        4.8.7                         2  
qtconsole                 4.4.3                      py_0    conda-forge
readline                  7.0                  ha6073c6_4  
requests                  2.18.4                   py36_1    conda-forge
rise                      5.4.1                 py36_1000    conda-forge
scipy                     1.2.1            py36h09a28d5_1    conda-forge
scs                       2.0.2           py36hcd175bc_1001    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                39.1.0                   py36_0  
simplegeneric             0.8.1                    py36_0    conda-forge
sip                       4.18                     py36_1    conda-forge
six                       1.11.0           py36h372c433_1  
sqlalchemy                1.2.7            py36h65ede16_0    conda-forge
sqlite                    3.26.0            h67949de_1001    conda-forge
terminado                 0.8.1                    py36_0    conda-forge
testpath                  0.3.1                    py36_0    conda-forge
tk                        8.6.9             h84994c4_1000    conda-forge
toolz                     0.9.0                      py_1    conda-forge
tornado                   5.0.2                    py36_0    conda-forge
traitlets                 4.3.2                    py36_0    conda-forge
urllib3                   1.22                     py36_0    conda-forge
wcwidth                   0.1.7                    py36_0    conda-forge
webencodings              0.5                      py36_0    conda-forge
wheel                     0.31.1                   py36_0  
widgetsnbextension        3.2.1                    py36_0    conda-forge
xz                        5.2.4                h14c3975_4  
zeromq                    4.2.5                         1    conda-forge
zlib                      1.2.11               ha838bed_2  
feribg commented 5 years ago

Your version of beakerx is 1.0.0 and mine from conda is 1.3.0, that seems like a meaningful difference.

tschm commented 5 years ago

Yes, that's certainly an issue. Using the beakerx docker container also comes with a lot of extra excitement. For example if you try to install matplotlib or scipy or ... via conda, conda will update tornado and break the entire setup by doing so. beakerx 1.0.0 won't work with tornado 6. At the moment I rely on the beakerx container and stick to pip install for further packages. Dependency hell alive. I guess there must be a way to tell conda to be really defensive when I install packages.

LeeTZ commented 5 years ago

I can reproduce the bug. We will take a look. And also the docker image beakerx:latest will be updated with the tornado fix so latest beakerx would stand with tornado peacefully. Thank you all for report!