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

Jupyer Lab prints to the log #185

Open
SimeonEhrig opened this issue Mar 26, 2020 · 6 comments
Open

Jupyer Lab prints to the log #185

SimeonEhrig opened this issue Mar 26, 2020 · 6 comments

Comments

@SimeonEhrig
Copy link

Problem

When I try to run the Button Widget section of the example in Jupyter Lab, the output of foo() is printed to the log.

xwidgts_log
(Kernel C++14)

Environment

I have installed xeus-cling and xwidgets via conda:

conda create -n xwidgets python=3.7
conda activate xwidgets
conda install xeus-cling xwidgets -c conda-forge
conda install -c conda-forge jupyterlab
conda install -c conda-forge nodejs
jupyter labextension install @jupyter-widgets/jupyterlab-manager

conda list

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
attrs                     19.3.0                     py_0    conda-forge
backcall                  0.1.0                      py_0    conda-forge
binutils_impl_linux-64    2.33.1               he1b5a44_7    conda-forge
binutils_linux-64         2.33.1              h9595d00_17    conda-forge
bleach                    3.1.3              pyh8c360ce_0    conda-forge
ca-certificates           2019.11.28           hecc5488_0    conda-forge
certifi                   2019.11.28       py37hc8dfbb8_1    conda-forge
clang_variant             1.0                  cling_v0.6    conda-forge
clangdev                  5.0.0             hb222dda_1006    conda-forge
cling                     0.6                  he513fc3_2    conda-forge
cppzmq                    4.3.0             hc9558a2_1001    conda-forge
decorator                 4.4.2                      py_0    conda-forge
defusedxml                0.6.0                      py_0    conda-forge
entrypoints               0.3             py37hc8dfbb8_1001    conda-forge
gcc_impl_linux-64         7.3.0                habb00fd_1  
gcc_linux-64              7.3.0               h553295d_17    conda-forge
gxx_impl_linux-64         7.3.0                hdf63c60_1  
gxx_linux-64              7.3.0               h553295d_17    conda-forge
icu                       64.2                 he1b5a44_1    conda-forge
importlib-metadata        1.5.2            py37hc8dfbb8_0    conda-forge
importlib_metadata        1.5.2                         0    conda-forge
ipykernel                 5.2.0            py37h43977f1_0    conda-forge
ipython                   7.13.0           py37hc8dfbb8_2    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
jedi                      0.16.0           py37hc8dfbb8_1    conda-forge
jinja2                    2.11.1                     py_0    conda-forge
json5                     0.9.0                      py_0    conda-forge
jsonschema                3.2.0            py37hc8dfbb8_1    conda-forge
jupyter_client            6.1.1                      py_0    conda-forge
jupyter_core              4.6.3            py37hc8dfbb8_1    conda-forge
jupyterlab                2.0.1                      py_0    conda-forge
jupyterlab_server         1.0.7                      py_0    conda-forge
ld_impl_linux-64          2.33.1               h53a641e_7  
libedit                   3.1.20181209         hc058e9b_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 9.1.0                hdf63c60_0  
libsodium                 1.0.17               h516909a_0    conda-forge
libstdcxx-ng              9.1.0                hdf63c60_0  
libuuid                   2.32.1            h14c3975_1000    conda-forge
libuv                     1.34.0               h516909a_0    conda-forge
markupsafe                1.1.1            py37h8f50634_1    conda-forge
mistune                   0.8.4           py37h516909a_1000    conda-forge
nbconvert                 5.6.1                    py37_0    conda-forge
nbformat                  5.0.4                      py_0    conda-forge
ncurses                   6.2                  he6710b0_0  
nlohmann_json             3.7.3                he1b5a44_1    conda-forge
nodejs                    13.10.1              hf5d1a2b_0    conda-forge
notebook                  6.0.3                    py37_0    conda-forge
openssl                   1.1.1e               h516909a_0    conda-forge
pandoc                    2.9.2                         0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
parso                     0.6.2                      py_0    conda-forge
pexpect                   4.8.0            py37hc8dfbb8_1    conda-forge
pickleshare               0.7.5           py37hc8dfbb8_1001    conda-forge
pip                       20.0.2                   py37_1  
prometheus_client         0.7.1                      py_0    conda-forge
prompt-toolkit            3.0.4                      py_0    conda-forge
ptyprocess                0.6.0                   py_1001    conda-forge
pugixml                   1.10                 he1b5a44_1    conda-forge
pygments                  2.6.1                      py_0    conda-forge
pyrsistent                0.16.0           py37h8f50634_0    conda-forge
python                    3.7.7           h191fe78_0_cpython  
python-dateutil           2.8.1                      py_0    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
pyzmq                     19.0.0           py37hac76be4_1    conda-forge
readline                  7.0                  h7b6447c_5  
send2trash                1.5.0                      py_0    conda-forge
setuptools                46.1.1                   py37_0  
six                       1.14.0                     py_1    conda-forge
sqlite                    3.31.1               h7b6447c_0  
terminado                 0.8.3            py37hc8dfbb8_1    conda-forge
testpath                  0.4.4                      py_0    conda-forge
tk                        8.6.8                hbc83047_0  
tornado                   6.0.4            py37h8f50634_1    conda-forge
traitlets                 4.3.3            py37hc8dfbb8_1    conda-forge
wcwidth                   0.1.8              pyh9f0ad1d_1    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.34.2                   py37_0  
xeus                      0.23.5               h4d8c418_0    conda-forge
xeus-cling                0.8.1                he513fc3_2    conda-forge
xproperty                 0.10.1               hc9558a2_0    conda-forge
xtl                       0.6.13               hc9558a2_0    conda-forge
xwidgets                  0.20.0               hc9558a2_0    conda-forge
xz                        5.2.4                h14c3975_4  
zeromq                    4.3.2                he1b5a44_2    conda-forge
zipp                      3.1.0                      py_0    conda-forge
zlib                      1.2.11               h7b6447c_3  
@SylvainCorlay
Copy link
Member

Thanks @SimeonEhrig this is in fact expected behavior (same as with ipywidgets in lab) and we should change the notebook to use an output widget.

@SimeonEhrig
Copy link
Author

Thanks for the quick answer. Is the output widget already implemented?

@SylvainCorlay
Copy link
Member

Yes it is! You can see it in the widgets list notebook I think. It is used as a scope guard.

@SylvainCorlay
Copy link
Member

If you are interested in pushing on xwidgets, I should connect sometimes. We have some ideas (that are rather low-hanging) on how to make it as usable as ipywdgets.

@SimeonEhrig
Copy link
Author

I got it:

xwidgets_text

and also with pictures:
xwidgets_picture

I'm not sure if you should change the example notebook, because the Jupyter Notebook way is much easier than the Lab way. But you should at least provide a Jupyter Lab example, because I think the behaviour of Jupyter Lab is confusing for somebody who is not familiar with ipython widgets.

That's a good idea. We try to do interactive simulation and analysis in Jupyter Notebook with C++. Therefore we also need a simple way to quickly create a user interface for the analyses.

For the current Nvida GTC, @ax3l and I also offer a presentation that explains our idea: https://doi.org/10.5281/zenodo.3713753

@SylvainCorlay
Copy link
Member

Thanks! I think we should change the notebook, although I would display the output widget before the button is created so that there is something printed right away.

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

2 participants