bokeh / bokeh-notebooks

Interactive Web Plotting with Bokeh in IPython notebook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

missing dependency

TidyData opened this issue · comments

created environment file using the repo's environment.yml and was getting the below error quite frequently.

[E 22:54:05.375 NotebookApp] Notebook JSON is invalid: 'application/vnd.bokehjs_load.v0+json' does not match any of the regexes: '^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$'
    
    Failed validating 'additionalProperties' in display_data['properties']['data']:
    
    On instance['cells'][5]['outputs'][1]['data']:
    {'application/javascript': '\n'
                               '(function(root) {\n'
                               '  function now() {\n'
                               '    return new Date();\n'
                               '  }...',
     'application/vnd.bokehjs_load.v0+json': '\n'
                                             '(function(root) {\n'
                                             '  function now() {\n'
                                             '    return new Date();\n'
                                             '  }...'}

some searching indicated to install conda install -n bokeh nbformat

and problem seems to have gone away

i proposed a pull request TidyData:missing-dependency-72 which I believe resolves the error

@TidyData AFAIK that message indicates that you do not have the bokeh jupyterlab extension installed. nbformat is definitely not required for basic usage of Bokeh in either the classic notebook or jupyterlab. More details about package versions in your environment would be helpful here.

RHEL 8.1 4.18.0-147.3.1.el8_1.x86_64

Error occurs with multiple browsers.

I initially created the environment file using conda 4.8.0 but it still occurring after making another environment file using conda 4.8.1.
The 1st conda list has the error.
The 2nd conda list is after I installed nbformat and the error hasn't occurred for 30 minutes, when it took <2 seconds after starting a notebook

(bokeh_with_error) [<redacted> bokeh-notebooks]$ conda list
# packages in environment at <redacted>/miniconda3/envs/bokeh_with_error:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       0_gnu    conda-forge
attrs                     19.3.0                     py_0    conda-forge
backcall                  0.1.0                      py_0    conda-forge
bleach                    3.1.0                      py_0    conda-forge
bokeh                     1.4.0                      py_0    bokeh
ca-certificates           2019.11.28           hecc5488_0    conda-forge
certifi                   2019.11.28               py37_0    conda-forge
cffi                      1.13.2           py37h8022711_0    conda-forge
chardet                   3.0.4                 py37_1003    conda-forge
click                     7.0                        py_0    conda-forge
cloudpickle               1.2.2                      py_1    conda-forge
colorcet                  2.0.1                      py_0    conda-forge
cryptography              2.8              py37h72c5cf5_1    conda-forge
cycler                    0.10.0                     py_2    conda-forge
cytoolz                   0.10.1           py37h516909a_0    conda-forge
dask                      2.9.1                      py_0    conda-forge
dask-core                 2.9.1                      py_0    conda-forge
datashader                0.9.0                      py_0    conda-forge
datashape                 0.5.4                      py_1    conda-forge
decorator                 4.4.1                      py_0    conda-forge
defusedxml                0.6.0                      py_0    conda-forge
distributed               2.9.1                      py_0    conda-forge
entrypoints               0.3                   py37_1000    conda-forge
flask                     1.1.1                      py_1    conda-forge
fontconfig                2.13.1            h86ecdb6_1001    conda-forge
freetype                  2.10.0               he983fc9_1    conda-forge
fsspec                    0.6.2                      py_0    conda-forge
futures-compat            1.0                       py3_0    conda-forge
heapdict                  1.0.1                      py_0    conda-forge
holoviews                 1.12.7                     py_0    conda-forge
icu                       64.2                 he1b5a44_1    conda-forge
idna                      2.8                   py37_1000    conda-forge
imageio                   2.6.1                    py37_0    conda-forge
importlib_metadata        1.4.0                    py37_0    conda-forge
ipykernel                 5.1.3            py37h5ca1d4c_0    conda-forge
ipython                   7.11.1           py37h5ca1d4c_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
itsdangerous              1.1.0                      py_0    conda-forge
jedi                      0.15.2                   py37_0    conda-forge
jinja2                    2.10.3                     py_0    conda-forge
jpeg                      9c                h14c3975_1001    conda-forge
jsonschema                3.2.0                    py37_0    conda-forge
jupyter_client            5.3.4                    py37_0    conda-forge
jupyter_core              4.6.1                    py37_0    conda-forge
kiwisolver                1.1.0            py37hc9558a2_0    conda-forge
ld_impl_linux-64          2.33.1               h53a641e_7    conda-forge
libblas                   3.8.0               14_openblas    conda-forge
libcblas                  3.8.0               14_openblas    conda-forge
libffi                    3.2.1             he1b5a44_1006    conda-forge
libgcc-ng                 9.2.0                h24d8f2e_2    conda-forge
libgfortran-ng            7.3.0                hdf63c60_4    conda-forge
libgomp                   9.2.0                h24d8f2e_2    conda-forge
libiconv                  1.15              h516909a_1005    conda-forge
liblapack                 3.8.0               14_openblas    conda-forge
libllvm8                  8.0.1                hc9558a2_0    conda-forge
libopenblas               0.3.7                h5ec1e0e_6    conda-forge
libpng                    1.6.37               hed695b0_0    conda-forge
libsodium                 1.0.17               h516909a_0    conda-forge
libstdcxx-ng              9.2.0                hdf63c60_2    conda-forge
libtiff                   4.1.0                hc3755c2_3    conda-forge
libuuid                   2.32.1            h14c3975_1000    conda-forge
libxml2                   2.9.10               hee79883_0    conda-forge
llvmlite                  0.31.0           py37h8b12597_0    conda-forge
locket                    0.2.0                      py_2    conda-forge
lz4-c                     1.8.3             he1b5a44_1001    conda-forge
markupsafe                1.1.1            py37h516909a_0    conda-forge
matplotlib-base           3.1.2            py37h250f245_1    conda-forge
mistune                   0.8.4           py37h516909a_1000    conda-forge
more-itertools            8.0.2                      py_0    conda-forge
msgpack-python            0.6.2            py37hc9558a2_0    conda-forge
multipledispatch          0.6.0                      py_0    conda-forge
nbconvert                 5.6.1                    py37_0    conda-forge
nbformat                  5.0.3                      py_0    conda-forge
ncurses                   6.1               hf484d3e_1002    conda-forge
networkx                  2.4                        py_0    conda-forge
notebook                  6.0.1                    py37_0    conda-forge
numba                     0.47.0           py37hb3f55d8_0    conda-forge
numpy                     1.17.3           py37h95a1406_0    conda-forge
olefile                   0.46                       py_0    conda-forge
openssl                   1.1.1d               h516909a_0    conda-forge
packaging                 20.0                       py_0    conda-forge
pandas                    0.25.3           py37hb3f55d8_0    conda-forge
pandoc                    2.9.1.1                       0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
param                     1.9.2                      py_0    conda-forge
parso                     0.5.2                      py_0    conda-forge
partd                     1.1.0                      py_0    conda-forge
pexpect                   4.7.0                    py37_0    conda-forge
phantomjs                 2.1.1                         1    conda-forge
pickleshare               0.7.5                 py37_1000    conda-forge
pillow                    7.0.0            py37hefe7db6_0    conda-forge
pip                       19.3.1                   py37_0    conda-forge
prometheus_client         0.7.1                      py_0    conda-forge
prompt_toolkit            3.0.2                      py_0    conda-forge
psutil                    5.6.7            py37h516909a_0    conda-forge
ptyprocess                0.6.0                   py_1001    conda-forge
pycparser                 2.19                     py37_1    conda-forge
pyct                      0.4.6                      py_0    conda-forge
pyct-core                 0.4.6                      py_0    conda-forge
pygments                  2.5.2                      py_0    conda-forge
pyopenssl                 19.1.0                   py37_0    conda-forge
pyparsing                 2.4.6                      py_0    conda-forge
pyrsistent                0.15.7           py37h516909a_0    conda-forge
pysocks                   1.7.1                    py37_0    conda-forge
python                    3.7.6                h357f687_2    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
pytz                      2019.3                     py_0    conda-forge
pyviz_comms               0.7.2                      py_0    conda-forge
pywavelets                1.1.1            py37hc1659b7_0    conda-forge
pyyaml                    5.1.2            py37h516909a_0    conda-forge
pyzmq                     18.1.1           py37h1768529_0    conda-forge
readline                  8.0                  hf8c457e_0    conda-forge
requests                  2.22.0                   py37_1    conda-forge
scikit-image              0.16.2           py37hb3f55d8_0    conda-forge
scipy                     1.4.1            py37h921218d_0    conda-forge
selenium                  3.141.0         py37h516909a_1000    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                44.0.0                   py37_0    conda-forge
six                       1.13.0                   py37_0    conda-forge
sortedcontainers          2.1.0                      py_0    conda-forge
sqlite                    3.30.1               hcee41ef_0    conda-forge
tblib                     1.6.0                      py_0    conda-forge
terminado                 0.8.3                    py37_0    conda-forge
testpath                  0.4.4                      py_0    conda-forge
tk                        8.6.10               hed695b0_0    conda-forge
toolz                     0.10.0                     py_0    conda-forge
tornado                   6.0.3            py37h516909a_0    conda-forge
traitlets                 4.3.3                    py37_0    conda-forge
urllib3                   1.25.7                   py37_0    conda-forge
wcwidth                   0.1.8                      py_0    conda-forge
webencodings              0.5.1                      py_1    conda-forge
werkzeug                  0.16.0                     py_0    conda-forge
wheel                     0.33.6                   py37_0    conda-forge
xarray                    0.14.1                     py_1    conda-forge
xz                        5.2.4             h14c3975_1001    conda-forge
yaml                      0.1.7             h14c3975_1001    conda-forge
zeromq                    4.3.2                he1b5a44_2    conda-forge
zict                      1.0.0                      py_0    conda-forge
zipp                      0.6.0                      py_0    conda-forge
zlib                      1.2.11            h516909a_1006    conda-forge
zstd                      1.4.4                h3b9ef0a_1    conda-forge

Below has the error resolved after installing nbformat

(bokeh) [<redacted> bokeh-notebooks]$ conda list
# packages in environment at <redacted> /miniconda3/envs/bokeh:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       0_gnu    conda-forge
attrs                     19.3.0                     py_0    conda-forge
backcall                  0.1.0                      py_0    conda-forge
bleach                    3.1.0                      py_0    conda-forge
bokeh                     1.4.0                      py_0    bokeh
ca-certificates           2019.11.27                    0  
certifi                   2019.11.28               py37_0  
cffi                      1.13.2           py37h8022711_0    conda-forge
chardet                   3.0.4                 py37_1003    conda-forge
click                     7.0                        py_0    conda-forge
cloudpickle               1.2.2                      py_1    conda-forge
colorcet                  2.0.1                      py_0    conda-forge
cryptography              2.8              py37h72c5cf5_1    conda-forge
cycler                    0.10.0                     py_2    conda-forge
cytoolz                   0.10.1           py37h516909a_0    conda-forge
dask                      2.9.1                      py_0    conda-forge
dask-core                 2.9.1                      py_0    conda-forge
datashader                0.9.0                      py_0    conda-forge
datashape                 0.5.4                      py_1    conda-forge
decorator                 4.4.1                      py_0    conda-forge
defusedxml                0.6.0                      py_0    conda-forge
distributed               2.9.1                      py_0    conda-forge
entrypoints               0.3                   py37_1000    conda-forge
flask                     1.1.1                      py_1    conda-forge
fontconfig                2.13.1            h86ecdb6_1001    conda-forge
freetype                  2.10.0               he983fc9_1    conda-forge
fsspec                    0.6.2                      py_0    conda-forge
futures-compat            1.0                       py3_0    conda-forge
heapdict                  1.0.1                      py_0    conda-forge
holoviews                 1.12.7                     py_0    conda-forge
icu                       64.2                 he1b5a44_1    conda-forge
idna                      2.8                   py37_1000    conda-forge
imageio                   2.6.1                    py37_0    conda-forge
importlib_metadata        1.4.0                    py37_0    conda-forge
ipykernel                 5.1.3            py37h5ca1d4c_0    conda-forge
ipython                   7.11.1           py37h5ca1d4c_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
itsdangerous              1.1.0                      py_0    conda-forge
jedi                      0.15.2                   py37_0    conda-forge
jinja2                    2.10.3                     py_0    conda-forge
jpeg                      9c                h14c3975_1001    conda-forge
jsonschema                3.2.0                    py37_0    conda-forge
jupyter_client            5.3.4                    py37_0    conda-forge
jupyter_core              4.6.1                    py37_0    conda-forge
kiwisolver                1.1.0            py37hc9558a2_0    conda-forge
ld_impl_linux-64          2.33.1               h53a641e_7    conda-forge
libblas                   3.8.0               14_openblas    conda-forge
libcblas                  3.8.0               14_openblas    conda-forge
libffi                    3.2.1             he1b5a44_1006    conda-forge
libgcc-ng                 9.2.0                h24d8f2e_2    conda-forge
libgfortran-ng            7.3.0                hdf63c60_4    conda-forge
libgomp                   9.2.0                h24d8f2e_2    conda-forge
libiconv                  1.15              h516909a_1005    conda-forge
liblapack                 3.8.0               14_openblas    conda-forge
libllvm8                  8.0.1                hc9558a2_0    conda-forge
libopenblas               0.3.7                h5ec1e0e_6    conda-forge
libpng                    1.6.37               hed695b0_0    conda-forge
libsodium                 1.0.17               h516909a_0    conda-forge
libstdcxx-ng              9.2.0                hdf63c60_2    conda-forge
libtiff                   4.1.0                hc3755c2_3    conda-forge
libuuid                   2.32.1            h14c3975_1000    conda-forge
libxml2                   2.9.10               hee79883_0    conda-forge
llvmlite                  0.31.0           py37h8b12597_0    conda-forge
locket                    0.2.0                      py_2    conda-forge
lz4-c                     1.8.3             he1b5a44_1001    conda-forge
markupsafe                1.1.1            py37h516909a_0    conda-forge
matplotlib-base           3.1.2            py37h250f245_1    conda-forge
mistune                   0.8.4           py37h516909a_1000    conda-forge
more-itertools            8.0.2                      py_0    conda-forge
msgpack-python            0.6.2            py37hc9558a2_0    conda-forge
multipledispatch          0.6.0                      py_0    conda-forge
nbconvert                 5.6.1                    py37_0    conda-forge
nbformat                  4.4.0                    py37_0  
ncurses                   6.1               hf484d3e_1002    conda-forge
networkx                  2.4                        py_0    conda-forge
notebook                  6.0.1                    py37_0    conda-forge
numba                     0.47.0           py37hb3f55d8_0    conda-forge
numpy                     1.17.3           py37h95a1406_0    conda-forge
olefile                   0.46                       py_0    conda-forge
openssl                   1.1.1d               h7b6447c_3  
packaging                 20.0                       py_0    conda-forge
pandas                    0.25.3           py37hb3f55d8_0    conda-forge
pandoc                    2.9.1.1                       0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
param                     1.9.2                      py_0    conda-forge
parso                     0.5.2                      py_0    conda-forge
partd                     1.1.0                      py_0    conda-forge
pexpect                   4.7.0                    py37_0    conda-forge
phantomjs                 2.1.1                         1    conda-forge
pickleshare               0.7.5                 py37_1000    conda-forge
pillow                    7.0.0            py37hefe7db6_0    conda-forge
pip                       19.3.1                   py37_0    conda-forge
prometheus_client         0.7.1                      py_0    conda-forge
prompt_toolkit            3.0.2                      py_0    conda-forge
psutil                    5.6.7            py37h516909a_0    conda-forge
ptyprocess                0.6.0                   py_1001    conda-forge
pycparser                 2.19                     py37_1    conda-forge
pyct                      0.4.6                      py_0    conda-forge
pyct-core                 0.4.6                      py_0    conda-forge
pygments                  2.5.2                      py_0    conda-forge
pyopenssl                 19.1.0                   py37_0    conda-forge
pyparsing                 2.4.6                      py_0    conda-forge
pyrsistent                0.15.7           py37h516909a_0    conda-forge
pysocks                   1.7.1                    py37_0    conda-forge
python                    3.7.6                h357f687_2    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
pytz                      2019.3                     py_0    conda-forge
pyviz_comms               0.7.2                      py_0    conda-forge
pywavelets                1.1.1            py37hc1659b7_0    conda-forge
pyyaml                    5.1.2            py37h516909a_0    conda-forge
pyzmq                     18.1.1           py37h1768529_0    conda-forge
readline                  8.0                  hf8c457e_0    conda-forge
requests                  2.22.0                   py37_1    conda-forge
scikit-image              0.16.2           py37hb3f55d8_0    conda-forge
scipy                     1.4.1            py37h921218d_0    conda-forge
selenium                  3.141.0         py37h516909a_1000    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                44.0.0                   py37_0    conda-forge
six                       1.13.0                   py37_0    conda-forge
sortedcontainers          2.1.0                      py_0    conda-forge
sqlite                    3.30.1               hcee41ef_0    conda-forge
tblib                     1.6.0                      py_0    conda-forge
terminado                 0.8.3                    py37_0    conda-forge
testpath                  0.4.4                      py_0    conda-forge
tk                        8.6.10               hed695b0_0    conda-forge
toolz                     0.10.0                     py_0    conda-forge
tornado                   6.0.3            py37h516909a_0    conda-forge
traitlets                 4.3.3                    py37_0    conda-forge
urllib3                   1.25.7                   py37_0    conda-forge
wcwidth                   0.1.8                      py_0    conda-forge
webencodings              0.5.1                      py_1    conda-forge
werkzeug                  0.16.0                     py_0    conda-forge
wheel                     0.33.6                   py37_0    conda-forge
xarray                    0.14.1                     py_1    conda-forge
xz                        5.2.4             h14c3975_1001    conda-forge
yaml                      0.1.7             h14c3975_1001    conda-forge
zeromq                    4.3.2                he1b5a44_2    conda-forge
zict                      1.0.0                      py_0    conda-forge
zipp                      0.6.0                      py_0    conda-forge
zlib                      1.2.11            h516909a_1006    conda-forge
zstd                      1.4.4                h3b9ef0a_1    conda-forge

I don't doubt that you are experiencing some issue, but I cannot see any way that nbformat could be related. It is used in precisely one place in the Bokeh codebase:

(base) ❯ grip nbformat
./application/handlers/notebook.py:
   70 :         nbformat = import_required('nbformat', 'The Bokeh notebook application handler requires Jupyter Notebook to be installed.')
  114 :             nb = nbformat.read(f, nbformat.NO_CONVERT)

This is the code path that is used when you run a notebook as a Bokeh server application, i.e. only when you execute bokeh serve foo.ipynb, and nowhere else. It has nothing at all to do with displaying things in a standard running notebook. And then also with notebooks, nbformat is only relevant when exporting notebooks as static html, not when actually running live notebooks connected to a kernel. Lastly, many people use Bokeh in notebooks without nbformat installed without issue.

So, being frank, I think the apparent fix is either a coincidence, or there is some separate connected cause. I'd encourage you to try and make more observations around this and maybe we can get to the root problem.

Frankness appreciated, feel free to close the issue. It can always be re-opened if others experience this issue.

RHEL 8 is new, possible source candidate for problem injections.

I'm running jupyter notebook (not fancy jupyter lab environment, but the old ipython version) and going through the bokeh-notebook tutorial lessons.

The difference between the two virtual environments is listed below. Possibly, another python module instead, maybe openssl, provides some functionality?

ca-certificates           2019.11.27                    0  
certifi                   2019.11.28               py37_0  
nbformat                  4.4.0                    py37_0  
openssl                   1.1.1d               h7b6447c_3  

thanks for supporting bokeh, it is wonderful

@TidyData I was considering merging the PR today, has there been an update on the situation on your end?

no update, was just trying to not leave issues hanging. Last I understood my fix wasn't the root of the problem and just didn't want things to linger if not relevant. Sorry to confuse. If I can provide additional testing I am happy to assist.

I couldn't tell if changes were applied to all branches due to some script when master gets committed too or if actual commits were applied to the merge request branch.

@TidyData Well, I still don't see how it can be the root of the problem, however:

  • I could always be wrong, and
  • adding it to the env is a pretty minimal and otherwise harmless change

So, on balance, in the interests of doing something that is not-harmful, possibly-useful I figured we could just merge it.

I don't understand the second question. There was a merge conflict with master on the branch which I just resolved in the GH UI a few minutes ago. Those changes appear on your branch to make the merge clean.

Actually @TidyData here is one more quick check you can do: You mention things work after installing nbformat. What happens if you now remove nbformat? Does it break again, or do things continue to still work? If not, I think this is a path, or else some secondary dependency, an installing nbformat is incidentally fixing that.

Also, thank you very much for the kind words earlier

I made various environments and think we can drop nbformat in environment.yml but retain package jupyter_contrib_nbextensions

without jupyter_contrib_nbextensions in less than 2 seconds was receiving below error
Screenshot from 2020-02-17 11-28-14

Interesting I don't know much about that package but it seems more likely to be relevant. Can you make a new PR for that package and we'll get it merged today!

Actually I guess it is already recently added on master:

https://github.com/bokeh/bokeh-notebooks/blob/master/environment.yml

So I don't think there is any further work?

agreed, closing this issue and the remaining pull request only has additional comments, which isn't that beneficial overall. Will be closing both with no need to merge.

- jupyter_contrib_nbextensions # resolves notebook validation failed

if for some reason you want to merge it, you're welcome to open the pull request and merge it in.

good work team, Go Bokeh!

@TidyData sounds good, thanks!