Coder Social home page Coder Social logo

bokeh / jupyter_bokeh Goto Github PK

View Code? Open in Web Editor NEW
239.0 21.0 46.0 1.12 MB

An extension for rendering Bokeh content in JupyterLab notebooks

License: BSD 3-Clause "New" or "Revised" License

TypeScript 59.91% Python 26.66% JavaScript 11.75% Shell 1.58% CSS 0.10%
jupyterlab-extension jupyterlab bokeh

jupyter_bokeh's Introduction

jupyter_bokeh

Github Actions Status

A Jupyter extension for rendering Bokeh content within Jupyter. See also the separate ipywidgets_bokeh library for support for using Jupyter widgets/ipywidgets objects within Bokeh applications.

Install

For versions 3.0 and newer of JupyterLab, you have the option to install jupyter_bokeh with either pip or conda:

pip install jupyter_bokeh

or

conda install -c conda-forge jupyter_bokeh

For versions of Jupyter Lab older than 3.0, you must install the labextension separately:

conda install -c conda-forge jupyter_bokeh
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install @bokeh/jupyter_bokeh

To install a specific version:

jupyter labextension install @bokeh/[email protected]

Compatibility

The core Bokeh library is generally version independent of JupyterLab and this jupyter_bokeh extension for versions of bokeh>=2.0.0.

Our goal is that jupyter_bokeh minor releases (using the SemVer pattern) are made to follow JupyterLab minor release bumps, while micro releases are for new jupyter_bokeh features or bug fix releases. We've been previously inconsistent with having the extension release minor version bumps track that of JupyterLab, so users seeking to find extension releases that are compatible with their JupyterLab installation may refer to the below table.

Compatible JupyterLab and jupyter_bokeh versions
JupyterLab jupyter_bokeh
0.34.x 0.6.2
0.35.x 0.6.3
1.0.x 1.0.0
2.0.x 2.0.0
3.0.x 3.0.0
4.0.x 4.0.0

Contributing

Development install

Note: You will need NodeJS to build the extension package.

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
# Change directory to the jupyter_bokeh directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm run build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the jlpm run build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

jupyter lab build --minimize=False

Uninstall

pip uninstall jupyter_bokeh

jupyter_bokeh's People

Contributors

athornton avatar blink1073 avatar bollwyvl avatar bryevdv avatar canavandl avatar canavandl-test avatar ceball avatar dependabot[bot] avatar hoxbro avatar jbednar avatar lgtm-migrator avatar mattpap avatar mcg1969 avatar philippjfr avatar sdbbs avatar stonebig avatar tcmetzger avatar vidartf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jupyter_bokeh's Issues

Not rendering image np.uint16 in Jupyter Notebooks

Hello,

I'm having issues plotting a 2D array of np.uint16 datatype. If I convert it to np.uint32 or to np.float16. Is this datatype supported?

array = 2Darray

source = ColumnDataSource(data=dict(image=[array]))
p = figure(plot_width=width, x_range=(0, size_x), y_range=(0, size_y * y_factor), match_aspect=True,tooltips=[("x", "$x{0}"), ("y", "$y{0}"), ("value", "@image{0.00}")])

p.image(image='image', x=0, y=0, dw=size_x, dh=size_y, color_mapper=color_mapper)
jupyter                   1.0.0                    py37_7  
jupyter-server-proxy      1.1.0                    pypi_0    pypi
jupyter_client            5.3.3                    py37_1  
jupyter_console           6.0.0                    py37_0  
jupyter_core              4.5.0                      py_0  
jupyterhub                1.0.0                    py37_0    conda-forge
jupyterhub-dummyauthenticator 0.3.1                    pypi_0    pypi
jupyterlab                1.1.4              pyhf63ae98_0  
jupyterlab-nvdashboard    0.1.9                    pypi_0    pypi
jupyterlab_code_formatter 0.5.0                      py_0    conda-forge
jupyterlab_server         1.0.6                      py_0  
bokeh                     1.0.4                    py37_0

Thanks! and congrats for the great work!

AutocompleteWidget shows but dropdown has css or size problem

Hi,
Awesome work guys!
I'm trying to use an Autocomplete Input Widget in JupyterLab.
It shows up after loading Bokeh and looks perfect.
The HTML behaviour works perfectly, inspecting the code I can see a line for each completion.
But cssly, visually, I have a strange zone where I can't see anything nor click anything.
I guess that problem is very small but can't find a workaround.
Any Idea? Did I miss something?

Here are additional infos, screenshots and html result.

JupyterLab Version 0.35.4
Browser Firefox 52.7.3 and Firefox 67.0 Beta Developer edition
IPython - 7.3.0
Pandas - 0.24.2
Bokeh - 1.0.4
2019-03-25 17_38_20-JupyterLab - Firefox Developer Edition

<div class="bk-root" id="a125a6c8-4ae8-4ab1-9e10-521b544a8a59" data-root-id="1004">
  <div id="AA1D456DFABC4F618379C3426887F247" class="bk-widget bk-widget-form-group bk-layout-fixed bk-bs-open">
    <label for="1004">test</label>
    <input class="bk-widget-form-input bk-autocomplete-input" id="1004" value="ba" placeholder="" type="text">
    <ul class="bk-bs-dropdown-menu">
      <li><a data-text="bar">bar</a></li>
      <li><a data-text="baz">baz</a></li>
    </ul>
  </div>
</div>

Thanks!

Rename to jupyter_bokeh

In light of PR #71, which makes this a dual jlab/nb extension, it would be nice to rename this repository to jupyter_bokeh and publish pip/conda/npm packages under that name. Currently references to jupyterlab_bokeh are pretty sparse. For example in bokeh we have:

$ git grep -l jupyterlab_bokeh
bokehjs/src/lib/embed/notebook.ts
sphinx/source/docs/releases/0.12.9.rst
sphinx/source/docs/user_guide/notebook.rst

Just to note, currently naming conventions in the jupyter community are all over the place, with some still using ipy prefix, that doesn't seem to be appropriate anymore in my opinion.

@bryevdv, any thoughts?

`push_notebook` not updating all views

Duplicating output view in JupyterLab somehow breaks push_notebook as only one view gets updated (see gif for better demonstration).

push_notebook

As our user story is about having the plot in parallel with the executed notebook, a workaround was implemented by using the sidecar widget (and adding to it an anchor attribute). See jupyter-widgets/jupyterlab-sidecar#8

But as suggested by @jasongrout, push_notebook should be fixed.

Versions used:

  • bokeh 0.12.16
  • jupyterlab 0.32.1
  • jupyterlab_bokeh 0.5.0

Thanks for your awesome work

Compatibility with jupyterlab 1.0.x

Can you please make your extension compatible with the recently released juypterlab 1.0.x ?
Currently using your extension with jupyterlab means being downgraded to 0.2.0 which is from a long long time ago.
Sadly there is no labextension install --force to use the newest version nevertheless (or I did not find it).
Thanks in advance :)

Help Installing jupyterlab_bokeh

Hi!
I am new in this field.. I am doing some tutorials about bokeh and I am trying to display a plot inside the JupyterLab notebook. I know I need to install the jupyterlab_bokeh app but I can not manage to do from the terminal. I have the latest versions of:
bokeh 0.12.10
jupyter 1.0.0
jupyter_client 5.1.0
jupyter_console 5.2.0
jupyter_core 4.3.0
jupyterlab 0.27.0
jupyterlab_launcher 0.4.0
Thank you!

Tooltips not puplating

referring to #55 it's still not working in my environment:

Name Version Build Channel

bokeh 1.0.0 py36_0
jupyterlab 0.35.2 py36_0
jupyterlab_server 0.2.0 py36_0

when I reinstall labextension by
jupyter labextension install jupyterlab_bokeh
jupyterlab_bokeh-0.6.3.tgz
Node v8.12.0
I saw som warnings:
warning css-loader > cssnano > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning css-loader > cssnano > postcss-merge-rules > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning css-loader > cssnano > postcss-merge-rules > caniuse-api > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "@jupyterlab/vdom-extension > @nteract/[email protected]" has incorrect peer dependency "react@^15.6.1".
[5/5] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.10.1", while you're on "1.9.4".
Done in 58.74s.

`jupyterlab_bokeh` labextension doesn't install with jupyterlab 0.28

I've installed jupyterlab via conda

conda list jupyter
# packages in environment at /home/achim/miniconda3/envs/good-life-adventures:
#
jupyter_client            5.1.0                    py36_0    conda-forge
jupyter_core              4.3.0                    py36_0    conda-forge
jupyterlab                0.28.0                   py36_0    conda-forge
jupyterlab_launcher       0.5.4                    py36_0    conda-forge

And the latest bokeh from pip

pip install bokeh

Trying to install the extension with jupyter labextension install jupyterlab_bokeh results in:

ValueError: 
"[email protected]" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension            Package
>=0.11.1-0 <0.12.0-0    >=0.10.0-0 <0.11.0-0 @jupyterlab/application

Same, if I use the jupyterlab version from pip. (have read #4 - and hope/believe it is not a duplicate)

I guess the extension needs an update?! Thanks!

ValueError: setting 'version' makes sense only when 'mode' is set to 'cdn'

Total nube to bokeh on Jupyter Lab so pardon the ignorance but...
I'm seeing this error:
ValueError: setting 'version' makes sense only when 'mode' is set to 'cdn'
on the following line:
from bokeh.io import push_notebook, show, output_notebook
My Environment:

bokeh==0.12.14
jupyter==1.0.0
jupyter-client==5.2.3
jupyter-console==5.2.0
jupyter-core==4.4.0
jupyter-pip==0.3.1
jupyterhub==0.8.0
jupyterlab==0.31.8
jupyterlab-launcher==0.10.5
Python 3.6.2
run/s6/services/python$ jupyter labextension list
JupyterLab v0.31.8
Known labextensions:
   app dir: /opt/conda/share/jupyter/lab
@jupyterlab/plotly-extension
        @jupyterlab/plotly-extension v0.14.4  enabled  OK
jupyterlab_bokeh
        jupyterlab_bokeh v0.4.0  enabled  OK

Thanks for any help.

Rename test_cases to examples?

It would be nice if test_cases could be called examples to match all the various holoviz projects; right now it sounds like part of the test suite rather than a collection of examples to demo the functionality.

[email protected] is not compatible with JupyterLab 0.32

Bit of a drive-by FYI here. Received this error while trying to install the extension against the latest JupyterLab beta release (0.32).

12:23:49 "[email protected]" is not compatible with the current JupyterLab
12:23:49 Conflicting Dependencies:
12:23:49 JupyterLab              Extension        Package
12:23:49 >=0.16.2 <0.17.0        >=0.15.0 <0.16.0 @jupyterlab/application
12:23:49 >=0.16.3 <0.17.0        >=0.15.4 <0.16.0 @jupyterlab/apputils
12:23:49 >=0.16.2 <0.17.0        >=0.15.0 <0.16.0 @jupyterlab/notebook
12:23:49 >=2.0.2 <3.0.0          >=1.0.1 <2.0.0   @jupyterlab/services

I might have some time to try updating the dependency specs in jupyterlab_bokeh to see if it builds / functions. Leaving this issue here in case someone gets to it first.

Task: Enable responsive sizing_modes

Currently setting layout.responsive=True will result in the plot being responsively sized on initial load. However resizing the JLab Panel (either by dragging the edge or moving the panel) doesn't cause the plot to resize. Presumably the window size change events aren't being triggered by the panels natively.

push_notebook not updating plot

Installed versions:

  • JupyterLab 0.34.12
  • ipywidgets 7.4.2
  • bokeh 0.13.0 (or falling back to 0.12.6 because of bokeh/bokeh#8122)
  • jupyterlab_bokeh 0.6.2

To reproduce:

  1. Load the Notebook Handles example (https://bokeh.pydata.org/en/latest/docs/user_guide/notebook.html#notebook-handles)
  2. Run the cells up to and including the one that changes the fill color to white and calls push_notebook
  3. Note the plot does not update.

The JS console appears to contain errors about not being able to register a comm. Best guess: some kind of ipywidgets 7.4 compatibility problem.

The installation hangs at resolving jupyterlab_bokeh package

Hello!

When I try to install the extension, the installation doesnโ€™t progress any further than this:

...
[1/4] Resolving packages...
โ ‚ jupyterlab_bokeh@file:../extensions/jupyterlab_bokeh-0.5.0-b8336c4

I tried the following commands (with sudo):

jupyter labextension install jupyterlab_bokeh
npm install
jupyter labextension link .
npm install
jupyter labextension install .

I updated the jupyterlab package from PyPI before installation. Both my machines run Manjaro Linux.

Any help would be appreciated.

2018-05-08-191053_667x724_scrot

Expand README

The current README is just the cookiecutter-templated output. We should extend the README to:

  • Discuss what jupyterlab_bokeh does
  • Current deficiencies (no push_notebook, responsive sizing)
  • Add some screenshots

[email protected]" is not compatible with the current JupyterLab

Received following error:

jupyterlab_bokeh-0.5.0.tgz

Errored, use --debug for full output:
ValueError:
"[email protected]" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab Extension Package

=0.15.4-0 <0.16.0-0 >=0.16.0-0 <0.17.0-0 @jupyterlab/application
=0.15.5-0 <0.16.0-0 >=0.16.0-0 <0.17.0-0 @jupyterlab/apputils
=0.15.5-0 <0.16.0-0 >=0.16.0-0 <0.17.0-0 @jupyterlab/notebook
=1.1.4-0 <2.0.0-0 >=2.0.0-0 <3.0.0-0 @jupyterlab/services

How is this extension supposed to work?

Hi,

how is this extension supposed to work (a more extensive README would indeed be nice) ?
I installed the extension with jupyter labextension install jupyterlab_bokeh , and got a bunch of error messages for an optional dependency:

warning Error running install script for optional dependency: "/home/pahl/anaconda3/envs/chem/share/jupyter/lab/staging/node_modules/canvas: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /home/pahl/anaconda3/envs/chem/share/jupyter/lab/staging/node_modules/canvas
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp http GET https://nodejs.org/download/release/v9.7.1/node-v9.7.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v9.7.1/node-v9.7.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v9.7.1/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v9.7.1/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/home/pahl/.config/yarn/global/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pahl/anaconda3/envs/chem/share/jupyter/lab/staging/node_modules/canvas/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pahl/.config/yarn/global/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pahl/.node-gyp/9.7.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/pahl/.node-gyp/9.7.1',
gyp info spawn args   '-Dnode_gyp_dir=/home/pahl/.config/yarn/global/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/pahl/.node-gyp/9.7.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/pahl/anaconda3/envs/chem/share/jupyter/lab/staging/node_modules/canvas',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/pahl/anaconda3/envs/chem/share/jupyter/lab/staging/node_modules/canvas/build'
  SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
  COPY Release/canvas-postbuild.node
  CXX(target) Release/obj.target/canvas/src/Canvas.o
../src/Canvas.cc: In static member function โ€˜static void Canvas::ToBufferAsyncAfter(uv_work_t*)โ€™:
../src/Canvas.cc:221:31: warning: โ€˜v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) constโ€™ is deprecated [-Wdeprecated-declarations]
     closure->pfn->Call(1, argv);
                               ^
In file included from ../src/Canvas.h:22:0,
                 from ../src/Canvas.cc:7:
../../nan/nan.h:1568:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
../src/Canvas.cc:226:31: warning: โ€˜v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) constโ€™ is deprecated [-Wdeprecated-declarations]
     closure->pfn->Call(2, argv);
                               ^
In file included from ../src/Canvas.h:22:0,
                 from ../src/Canvas.cc:7:
../../nan/nan.h:1568:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
In file included from ../src/Canvas.cc:8:0:
../src/PNG.h: In function โ€˜cairo_status_t canvas_write_png(cairo_surface_t*, png_rw_ptr, void*)โ€™:
../src/PNG.h:73:20: warning: variable โ€˜statusโ€™ might be clobbered by โ€˜longjmpโ€™ or โ€˜vforkโ€™ [-Wclobbered]
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
                    ^~~~~~
  CXX(target) Release/obj.target/canvas/src/CanvasGradient.o
  CXX(target) Release/obj.target/canvas/src/CanvasPattern.o
In file included from ../src/CanvasPattern.cc:9:0:
../src/Image.h:19:10: fatal error: gif_lib.h: No such file or directory
 #include <gif_lib.h>
          ^~~~~~~~~~~
compilation terminated.
canvas.target.mk:127: recipe for target 'Release/obj.target/canvas/src/CanvasPattern.o' failed
make: *** [Release/obj.target/canvas/src/CanvasPattern.o] Error 1
make: Leaving directory '/home/pahl/anaconda3/envs/chem/share/jupyter/lab/staging/node_modules/canvas/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/pahl/.config/yarn/global/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:127:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.jssuccess Saved lockfile.
.........
Done in 35.73s

But otherwise the built seems to have worked.
However, after a restart of the server, I stll do not see any Bokeh plots in the JupyterLab notebook.
Am I missing an additional installation step? Do I have to activate the extension somewhere?

Many thanks.

Kind regards,
Axel

AutocompleteInput dropdown is hidden

I've just tried to use the AutocompleteInput and it's output both in jupyterlab and jupyter is hidden

Screenshot 2019-08-09 at 15 44 26

I tried to hack myself out of the issue by changing the CSS yet I can not force the appropriate div to z-index itself on top of the output. The value specified by bokeh is 100. JupyterLab uses internally values up to 10001. Moreover I am not sure whether I understand how exactly z-index should behave.

Fortunately you can scroll trough the bk div, yet it is not really user friendly.

jupyterlab v0.35.6
jupyterlab_bokeh v0.6.3

Install jupyterlab_bokeh got errors

I am using JupyterLab 0.32.1 on Kubernetes based ubuntu16.04.3LTS๏ผŒinstall jupyterlab_bokeh got errors as following๏ผš

jovyan@jupyter-supermap:~$ jupyter labextension install jupyterlab_bokeh

/opt/conda/bin/npm pack jupyterlab_bokeh
jupyterlab_bokeh-0.5.0.tgz
node /opt/conda/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install
yarn install v1.5.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@jupyterlab/json-extension > [email protected]" has incorrect peer dependency "react@^15.0.0".
warning "@jupyterlab/json-extension > [email protected]" has incorrect peer dependency "react-dom@^15.0.0".
warning "@jupyterlab/vdom-extension > @nteract/[email protected]" has incorrect peer dependency "react@^15.6.1".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 188.54s.
node /opt/conda/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build:prod
yarn run v1.5.1
$ webpack --config webpack.prod.config.js
/opt/conda/share/jupyter/lab/staging/node_modules/html-webpack-plugin/index.js:14
this.options = _.extend({
^

TypeError: _.extend is not a function
at new HtmlWebpackPlugin (/opt/conda/share/jupyter/lab/staging/node_modules/html-webpack-plugin/index.js:14:20)
at Object. (/opt/conda/share/jupyter/lab/staging/webpack.config.js:169:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/opt/conda/share/jupyter/lab/staging/webpack.prod.config.js:5:14)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c webpack --config webpack.prod.config.js
Directory: /opt/conda/share/jupyter/lab/staging
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/opt/conda/share/jupyter/lab/staging/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Jupyterlab dependency

When I try to install the jupyterlab extension, I get the following error:

>jupyter labextension install jupyterlab_bokeh
> npm pack jupyterlab_bokeh
Traceback (most recent call last):
  File "C:\Users\Tobias\Miniconda3\envs\PDSH_mod\Scripts\jupyter-labextension-sc
ript.py", line 5, in <module>
    sys.exit(jupyterlab.labextensions.main())
  File "C:\Users\Tobias\Miniconda3\envs\PDSH_mod\lib\site-packages\jupyter_core\
application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "C:\Users\Tobias\Miniconda3\envs\PDSH_mod\lib\site-packages\traitlets\con
fig\application.py", line 658, in launch_instance
    app.start()
  File "C:\Users\Tobias\Miniconda3\envs\PDSH_mod\lib\site-packages\jupyterlab\la
bextensions.py", line 167, in start
    super(LabExtensionApp, self).start()
  File "C:\Users\Tobias\Miniconda3\envs\PDSH_mod\lib\site-packages\jupyter_core\
application.py", line 256, in start
    self.subapp.start()
  File "C:\Users\Tobias\Miniconda3\envs\PDSH_mod\lib\site-packages\jupyterlab\la
bextensions.py", line 57, in start
    for arg in self.extra_args]
  File "C:\Users\Tobias\Miniconda3\envs\PDSH_mod\lib\site-packages\jupyterlab\la
bextensions.py", line 57, in <listcomp>
    for arg in self.extra_args]
  File "C:\Users\Tobias\Miniconda3\envs\PDSH_mod\lib\site-packages\jupyterlab\co
mmands.py", line 116, in install_extension
    raise ValueError(msg)
ValueError:
"[email protected]" is not compatible with the current JupyterLab
Conflicting Dependencies:
Required        Actual  Package
^0.8.2          ^0.10.0 @jupyterlab/application

This error is confusing because it does not match up with the version of Jupyterlab that I have installed.

>conda list jupyterlab
# packages in environment at C:\Users\Tobias\Miniconda3\envs\PDSH_mod:
#
jupyterlab                0.25.2                   py35_0    conda-forge
jupyterlab_launcher       0.3.1                    py35_0    conda-forge

>conda list bokeh
# packages in environment at C:\Users\Tobias\Miniconda3\envs\PDSH_mod:
#
bokeh                     0.12.9                     py_0    bokeh

Request: Conda package

Can a conda package be made for this? Right now the install takes a few minutes to install. Would a conda package be faster? A conda package would allow to list as a requirement in meta/environment.yml.

[Security] Don't expose Jupyter kernels to viewers

In order to add support for bokeh.io.push_notebook (#10) and not break Classic Notebook support, we attach the Jupyter kernel to window, so that BokehJS can attach an update callback to the document (#22). However, this adds a security vunerability as intruders can execute arbitrary python on the server.

This is likely a low-priority vunerability because an exposed JLab process already offers intruders a terminal to execute server-side code.

Review package.json dependencies

I believe there's one or two deps missing from the package.json (at least "@phoshor/disposable"), that are indirectly pulled in by other dependencies. We should make sure that our deps are locked down better

The pan and zoom tools doesn't work well in widget mode

Here is the code:

from bokeh.plotting import figure
from bokeh.models import ColumnDataSource
import jupyter_bokeh as jb
import numpy as np

fig = figure(height=200, width=300)
x = np.linspace(0, 10, 200)
y = np.sin(x)
source = ColumnDataSource(data=dict(x=x, y=y))
line = fig.line("x", "y", source=source)
fig_w = jb.BokehModel(fig)
fig_w

and the response of the pan and zoom operations.

fig_widget

Here is the version info:

Windows 10, Chrome and Firefox

bokeh: 1.4.0
jupyter lab: 1.2.1
notebook: 6.0.1
jupyter_bokeh: 1.1.0
python: 3.7.3

the widget mode means communicate between bokehjs and python kernel through ipywidgets.

Here is the example notebook:

https://github.com/bokeh/jupyter_bokeh/blob/master/examples/jupyter_widgets.ipynb

Memory leak when trying to repeatedly display plots using the same output widget

When I try to use bokeh in Jupyterlab to plot multiple times in a single Output widget, the old bokeh plots appear to stick around in memory even though they aren't actually accessible.

The following code will reproduce the issue (open up chrome's memory profiler and watch the memory increase as you click next).

from bokeh.plotting import figure, output_notebook, show

import ipywidgets as widgets
from ipywidgets import Layout, VBox
output_notebook()
import numpy as np

def plot_sample_bokeh(i):
    f = figure(title="test")
    f.line(np.arange(100), np.random.randn(100))
    
    show(f)

to_annotate = np.arange(100)
cur_index = 0

def display_img_widget(i):
    with out_widget:
        plot_sample_bokeh(i)
        
def on_button_click(b):
    global to_annotate, cur_index
    cur_id = to_annotate[cur_index]
    
    cur_index += 1
    
    if cur_index == len(to_annotate):
        print('End of collection')
        return
    out_widget.clear_output(wait=True)
    display_img_widget(to_annotate[cur_index])

a_button = widgets.Button(description='next', button_style='primary')
a_button.on_click(on_button_click)

out_widget = widgets.Output(width=1100, height=600)

display_img_widget(to_annotate[0])

form_item_layout = Layout(
    display='flex',
    flex_flow='row',
    justify_content='flex-start', width='100%')

form = VBox([a_button, out_widget], layout=form_item_layout)

form

I'm fairly sure that this is a bokeh specific thing (replacing plot_sample_bokeh with an ipywidget.Label doesn't show the same behavior, but that is a pretty simple widget).

jupyterlab: 0.35.4
jupyterlab_bokeh: v0.6.3

Cells which create bokeh plots do not get saved

I've encountered an issue where all cells which produce a bokeh plot in Jupyter Lab do not get saved.

Versions

$ jupyter labextension list
JupyterLab v0.31.8
Known labextensions:
   app dir: /opt/conda/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager
        @jupyter-widgets/jupyterlab-manager v0.33.2  enabled  OK
@jupyterlab/hub-extension
        @jupyterlab/hub-extension v0.8.1  enabled  OK
jupyterlab_bokeh
        jupyterlab_bokeh v0.4.0  enabled  OK

Reproducing

  • Create a new notebook
  • Create a cell with the following code
from bokeh.io import show, output_notebook
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.sampledata.commits import data
from bokeh.transform import jitter

output_notebook()

DAYS = ['Sun', 'Sat', 'Fri', 'Thu', 'Wed', 'Tue', 'Mon']

source = ColumnDataSource(data)

p = figure(plot_width=800, plot_height=300, y_range=DAYS, x_axis_type='datetime',
           title="Commits by Time of Day (US/Central) 2012-2016")

p.circle(x='time', y=jitter('day', width=0.6, range=p.y_range),  source=source, alpha=0.3)

p.xaxis[0].formatter.days = ['%Hh']
p.x_range.range_padding = 0
p.ygrid.grid_line_color = None

show(p)
  • Save the notebook
  • Restart Jupyter Lab
  • Open the notebook
  • The cell is missing

version 0.5.0 does not build

$ jupyter --version
4.4.0
$ jupyter lab --version
0.32.1
$ conda list bokeh
# packages in environment at /Users/user/anaconda3/envs/tryjlab:
#
# Name                    Version                   Build  Channel
bokeh                     0.12.15                  py36_0    conda-forge

Install with jupyter labextension install jupyterlab_bokeh.

 $ jupyter labextension list
JupyterLab v0.32.1
Known labextensions:
   app dir: /Users/user/anaconda3/envs/tryjlab/share/jupyter/lab
jupyterlab_bokeh
        jupyterlab_bokeh v0.5.0  enabled  OK

Build recommended, please run `jupyter lab build`:
    jupyterlab_bokeh needs to be included in build
$ jupyter lab build
[LabBuildApp] > node /Users/user/anaconda3/envs/tryjlab/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install

/Users/user/anaconda3/envs/tryjlab/lib/python3.6/site-packages/jupyterlab/staging/yarn.js:296
, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, 
                                                                    ^
SyntaxError: Unexpected token *
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
[LabBuildApp] > node /Users/user/anaconda3/envs/tryjlab/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build:prod

/Users/user/anaconda3/envs/tryjlab/lib/python3.6/site-packages/jupyterlab/staging/yarn.js:296
, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, 
                                                                    ^
SyntaxError: Unexpected token *
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Needed clarity on Bokeh setup in JupyterLab.

In very nice Bokeh Notebook Setup document simple example shows how easy to get Bokeh output rendered in Jupyter Notebook.

Unfortunately running Jupyter Notebook under Jupyter Lab breakes that simplisity.

import bokeh
from bokeh.io import output_notebook, show

print(bokeh.__version__)
output_notebook()

0.13.0
Loading BokehJS ...
JavaScript output is disabled in JupyterLab

Comments in JupiterLab issue log re-direct request to Bokeh saying it is security matter and vendor specific plug-in needs to be install. In contrast some users claim it is matter of integration - how you build/install JupyterLab (aka --dev-mode).

The jupyterlab_bokeh plugin README.md just says: jupyter labextension install jupyterlab_bokeh
Which is definetly not complete setup, some dependensies are missed.

$ jupyter labextension install jupyterlab_bokeh

ValueError: Please install nodejs 5+ and npm before continuing....

Could someone compile short setup instructions for installing dependencies and running Bokeh under JupyterLab? (not under conda, the real one please :)

Add jupyter_bokeh to PyPI

Would be great if we could upload jupyter_bokeh to PyPI now that it has been announced in the bokeh release blog.

Tooltips not populating

I tried the basic tooltip example from the bokeh guide, modified for the notebook and in jupyter lab the tooltip appears, and the labels are present, but not the values -- they are just blank.

from bokeh.plotting import figure, show, ColumnDataSource
from bokeh.io import output_notebook

# set the output to the notebook
output_notebook()

source = ColumnDataSource(data=dict(
    x=[1, 2, 3, 4, 5],
    y=[2, 5, 8, 2, 7],
    desc=['A', 'b', 'C', 'd', 'E'],
))

TOOLTIPS = [
    ("index", "$index"),
    ("(x,y)", "($x, $y)"),
    ("desc", "@desc"),
]

p = figure(plot_width=400, plot_height=400, tooltips=TOOLTIPS,
           title="Mouse over the dots")

p.circle('x', 'y', size=20, source=source)

show(p)

Extension doesn't install on jupyterlab 2.0.0

Jupyter Lab recently bumped its major version, and now this extension won't install, failing with the following message:

Building jupyterlab assets (build:prod:minimize)
An error occured.
ValueError: This extension does not yet support the current version of JupyterLab.

I guess it is because of these lines in package.json:

  "dependencies": {
    "@jupyterlab/application": "^1.1.3",
    "@jupyterlab/apputils": "^1.1.3",
    "@jupyterlab/docregistry": "^1.1.3",
    "@jupyterlab/notebook": "^1.1.3",
    "@jupyterlab/rendermime-interfaces": "^1.4.0",
    "@jupyterlab/services": "^4.1.1",
    "@jupyter-widgets/base": "^2.0.1",
    "@phosphor/coreutils": "^1.3.1",
    "@phosphor/disposable": "^1.3.1",
    "@phosphor/widgets": "^1.9.3"
  },

I'm not sure if the extension really isn't compatible, or if the dependency was pinned just to be cautious.

Does this extension change the way JupyterLab routes URL paths?

Referencing this issue I raised on the Altair repository....

The short: When I have the jupyterlab_bokeh extension installed, rendering Vega-Lite graphics via Altair fails if I reference the data by URL. Does this extension change the way JupyterLab routes URL paths?

The long: If I launch a notebook in freshly installed JupyterLab with a code cell containing the following code, everything runs fine.

import altair as alt

alt.Chart('test.json').mark_line().encode(x='x:Q', y='y:Q')

where the contents of test.json are:

[{"x":0,"y":0},{"x":1,"y":1}]

However, if I install the jupyter_bokeh labextension, The chart is not populated with data.

Disabling the jupyter_bokeh labextension does not solve the problem, nor does uninstalling it. Uninstalling and reinstalling JupyterLab does work.

Perhaps the jupyterlab_bokeh extension is changing the way JupyterLab accesses URLs? I would love to be able to use Altair and Bokeh seamlessly in my projects, so any help or fixes are appreciated.

System information

CPython 3.6.5
IPython 6.4.0

jupyterlab_bokeh: 0.5.0
jupyterlab 0.32.1
altair 2.1.0

compiler   : GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)
system     : Darwin
release    : 17.5.0
machine    : x86_64
processor  : i386
CPU cores  : 8
interpreter: 64bit

Fix lint failure on travis ci

Fails with System limit for number of file watchers reached, which is weird because there should be no watchers involved at all.

"[email protected]" is not compatible with the current JupyterLab

The extension is not compatible with JL 0.32 (beta2)

Conflicting Dependencies:
JupyterLab              Extension        Package
>=0.16.2 <0.17.0        >=0.15.0 <0.16.0 @jupyterlab/application
>=0.16.2 <0.17.0        >=0.15.0 <0.16.0 @jupyterlab/notebook
>=2.0.2 <3.0.0          >=1.0.1 <2.0.0   @jupyterlab/services

Resize handle feature

I am really missing the ability to resize the plot with the mouse like in the picture with the grey bottom right corner.

push_notebook not functional in jupyterlab 0.33

A simple ColumnDataSource update to a circle plot followed by a push_notebook(handle) does not update a plot in jupyterlab 0.33.0rc1.

@bryevdv suggested in this thread that the Jupyter folks have broken something recently and the bokeh extension requires an update.

Versions:

  • bokeh == 0.13
  • jupyterlab == 0.33.0rc1
  • jupyterlab_bokeh == 0.5.0 / current

Plots missing after tab refresh in jupyterlab 0.33

  1. Install bokeh 0.12.16 or 0.13.0, jupyterlab_bokeh 0.6, and jupyterlab 0.33.
  2. Run the following in a notebook cell and see the plot show up as expected.
from bokeh.io import push_notebook, show, output_notebook
from bokeh.layouts import row
from bokeh.plotting import figure
output_notebook()

opts = dict(plot_width=250, plot_height=250, min_border=0)

p1 = figure(**opts)
r1 = p1.circle([1,2,3], [4,5,6], size=20)

p2 = figure(**opts)
r2 = p2.circle([1,2,3], [4,5,6], size=20)

# get a handle to update the shown cell with
t = show(row(p1, p2), notebook_handle=True)
  1. Refresh the browser tab.
  2. When Lab reloads, the plots are missing.
  3. Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing shows in the JS console instead.

The plots did reappear properly after refresh in lab 0.32 with jupyterlab_bokeh 0.5.

Version compatibility with jupyterlab and bokeh?

Can you help me understand how the jupyterlab_bokeh extension versions are interoperable with the bokeh and jupyterlab versions?

I'm not suggesting that this is the best solution, but jupyterlab-manager publishes in their readme the version compatibilities. Something similar would be very useful here.

how to add https to notebook url

Hi,

I am creating an app in bokeh on jupyterlab and facing a problem with loading the app over https. Below is the code I am trying with the error:

doc = app.create_document() show(app, notebook_url='someurl.com:9000')

Error:
Mixed Content: The page at 'https://someurl.com/user/username/lab?' was loaded over HTTPS, but requested an insecure script 'http://someurl.com:36873/autoload.js?bokeh-autoload-element=066ed1ac-1b69-4246-8878-c9738a09ab8f&bokeh-app-path=/&bokeh-absolute-url=http://someurl.com:36873'. This request has been blocked; the content must be served over HTTPS.

Adding "https" to notebook_url doesn't work and gives an error as below:
doc = app.create_document() show(app, notebook_url='https://someurl.com:9000')

Error:
Invalid host value: https://someurl.com:9000

@canavandl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.