jupyterlab / jupyterlab

JupyterLab computational environment.
https://jupyterlab.readthedocs.io/
Other
14.17k stars 3.39k forks source link

Javascript Error: Failed to execute 'appendChild'. Occurs in JupyterLab, not in Classic Notebook. #12139

Closed jbaksta closed 2 years ago

jbaksta commented 2 years ago

Description

I have a user who exposed an bug in what looks like the JupyterLab Core Javascript. I really only run a JupyterHub instance and facilitate systems problems here. I've experienced it on our Linux boxes and my MacOS laptop. DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method. in the JavaScript console. Additionally the screen capture below.

image

Reproduce

Create a proper conda environment.

name: null
channels:
  - conda-forge
  - defaults
dependencies:
  - anyio
  - appnope
  - argon2-cffi
  - argon2-cffi-bindings
  - asttokens
  - attrs
  - babel
  - backcall
  - backports
  - backports.functools_lru_cache
  - black
  - bleach
  - brotli
  - brotli-bin
  - brotlipy
  - bzip2
  - ca-certificates
  - cctools
  - cctools_osx-64
  - certifi
  - cffi
  - charset-normalizer
  - clang
  - clang-12
  - clang_osx-64
  - clangxx
  - click
  - compiler-rt
  - compiler-rt_osx-64
  - cryptography
  - cycler
  - cytoolz
  - dataclasses
  - debugpy
  - decorator
  - defusedxml
  - entrypoints
  - executing
  - flit-core
  - freetype
  - gfortran
  - gfortran_impl_osx-64
  - gfortran_osx-64
  - giflib
  - gmp
  - icu
  - idna
  - importlib-metadata
  - importlib_metadata
  - ipykernel
  - ipython
  - ipython_genutils
  - isl
  - jbig
  - jedi
  - jinja2
  - jpeg
  - json5
  - jsonschema
  - jupyter_client
  - jupyter_core
  - jupyter_server
  - jupyterlab
  - jupyterlab_pygments
  - jupyterlab_server
  - kiwisolver
  - lcms2
  - ld64
  - ld64_osx-64
  - ld_impl_linux-64
  - ldid
  - lerc
  - libblas
  - libbrotlicommon
  - libbrotlidec
  - libbrotlienc
  - libcblas
  - libclang-cpp12
  - libcxx
  - libdeflate
  - libffi
  - libgfortran
  - libgfortran-devel_osx-64
  - libgfortran-ng
  - libgfortran5
  - libiconv
  - liblapack
  - libllvm12
  - libopenblas
  - libpng
  - libsodium
  - libtiff
  - libwebp
  - libwebp-base
  - libxcb
  - libzlib
  - llvm-openmp
  - llvm-tools
  - lz4-c
  - markupsafe
  - matplotlib
  - matplotlib-base
  - matplotlib-inline
  - mistune
  - mpc
  - mpfr
  - munkres
  - mypy_extensions
  - nbclassic
  - nbclient
  - nbconvert
  - nbformat
  - ncurses
  - nest-asyncio
  - notebook
  - numpy
  - openjpeg
  - openssl
  - packaging
  - pandoc
  - pandocfilters
  - parso
  - pathspec
  - pexpect
  - pickleshare
  - pillow
  - pip
  - platformdirs
  - prometheus_client
  - prompt-toolkit
  - pthread-stubs
  - ptyprocess
  - pure_eval
  - pycparser
  - pygments
  - pyopenssl
  - pyparsing
  - pyrsistent
  - pysocks
  - python
  - python-dateutil
  - python_abi
  - pytz
  - pyzmq
  - readline
  - requests
  - send2trash
  - setuptools
  - six
  - sniffio
  - sqlite
  - stack_data
  - tapi
  - terminado
  - testpath
  - tk
  - tomli
  - toolz
  - tornado
  - traitlets
  - typed-ast
  - typing_extensions
  - tzdata
  - urllib3
  - wcwidth
  - webencodings
  - websocket-client
  - wheel
  - xorg-libxau
  - xorg-libxdmcp
  - xz
  - zeromq
  - zipp
  - zlib
  - zstd
  - pip:
    - aenum
    - astunparse
    - boltons
    - cached-property
    - cmake
    - dace
    - devtools
    - dill
    - distro
    - flask
    - itsdangerous
    - mako
    - mpmath
    - networkx
    - ply
    - pybind11
    - pydantic
    - pyyaml
    - scikit-build
    - scipy
    - sympy
    - tabulate
    - typing-inspect
    - websockets
    - werkzeug
    - xxhash
    - git+https://github.com/gridtools/gt4py.git

Then run this example: https://github.com/GridTools/gt4py/blob/master/examples/demo_burgers.ipynb

Expected behavior

No JavaScript error

Context

Troubleshoot Output
% jupyter troubleshoot
$PATH:
    /Users/jbaker/miniconda/envs/jimenv/bin
    /Users/jbaker/miniconda/condabin
    /Users/jbaker/.rvm/gems/ruby-2.5.3/bin
    /Users/jbaker/.rvm/gems/ruby-2.5.3@global/bin
    /Users/jbaker/.rvm/rubies/ruby-2.5.3/bin
    ~/.local/bin
    /opt/local/bin
    /opt/local/sbin
    /opt/local/bin
    /usr/local/bin
    /usr/bin
    /bin
    /usr/sbin
    /sbin
    /usr/local/go/bin
    /usr/local/MacGPG2/bin
    /opt/X11/bin
    /Library/Apple/usr/bin
    /Applications/kitty.app/Contents/MacOS
    /Users/jbaker/.rvm/bin

sys.path:
    /Users/jbaker/miniconda/envs/jimenv/bin
    /Users/jbaker/miniconda/envs/jimenv/lib/python39.zip
    /Users/jbaker/miniconda/envs/jimenv/lib/python3.9
    /Users/jbaker/miniconda/envs/jimenv/lib/python3.9/lib-dynload
    /Users/jbaker/miniconda/envs/jimenv/lib/python3.9/site-packages

sys.executable:
    /Users/jbaker/miniconda/envs/jimenv/bin/python

sys.version:
    3.9.10 | packaged by conda-forge | (main, Feb  1 2022, 21:27:48) 
    [Clang 11.1.0 ]

platform.platform():
    macOS-11.6.4-x86_64-i386-64bit

which -a jupyter:
    /Users/jbaker/miniconda/envs/jimenv/bin/jupyter

pip list:
    Package                       Version
    ----------------------------- ---------
    aenum                         3.1.8
    anyio                         3.5.0
    appnope                       0.1.2
    argon2-cffi                   21.3.0
    argon2-cffi-bindings          21.2.0
    asttokens                     2.0.5
    astunparse                    1.6.3
    attrs                         21.4.0
    Babel                         2.9.1
    backcall                      0.2.0
    backports.functools-lru-cache 1.6.4
    black                         22.1.0
    bleach                        4.1.0
    boltons                       21.0.0
    brotlipy                      0.7.0
    cached-property               1.5.2
    certifi                       2021.10.8
    cffi                          1.15.0
    charset-normalizer            2.0.4
    click                         8.0.4
    cmake                         3.22.2
    cryptography                  36.0.0
    cycler                        0.11.0
    cytoolz                       0.11.2
    dace                          0.11.1
    dataclasses                   0.8
    debugpy                       1.5.1
    decorator                     5.1.1
    defusedxml                    0.7.1
    devtools                      0.8.0
    dill                          0.3.4
    distro                        1.7.0
    entrypoints                   0.4
    executing                     0.8.3
    Flask                         2.0.3
    flit_core                     3.7.1
    gt4py                         0.0.0
    idna                          3.3
    importlib-metadata            4.8.2
    ipykernel                     6.9.1
    ipython                       8.0.1
    ipython-genutils              0.2.0
    itsdangerous                  2.1.0
    jedi                          0.18.1
    Jinja2                        3.0.2
    json5                         0.9.6
    jsonschema                    3.2.0
    jupyter-client                7.1.2
    jupyter-core                  4.9.2
    jupyter-server                1.13.5
    jupyterlab                    3.2.9
    jupyterlab-pygments           0.1.2
    jupyterlab-server             2.10.3
    kiwisolver                    1.3.2
    Mako                          1.1.6
    MarkupSafe                    2.1.0
    matplotlib                    3.4.3
    matplotlib-inline             0.1.3
    mistune                       0.8.4
    mpmath                        1.2.1
    munkres                       1.1.4
    mypy-extensions               0.4.3
    nbclassic                     0.3.5
    nbclient                      0.5.11
    nbconvert                     6.4.2
    nbformat                      5.1.3
    nest-asyncio                  1.5.4
    networkx                      2.7
    notebook                      6.4.8
    numpy                         1.22.2
    packaging                     21.3
    pandocfilters                 1.5.0
    parso                         0.8.3
    pathspec                      0.9.0
    pexpect                       4.8.0
    pickleshare                   0.7.5
    Pillow                        9.0.1
    pip                           22.0.3
    platformdirs                  2.5.1
    ply                           3.11
    prometheus-client             0.13.1
    prompt-toolkit                3.0.27
    ptyprocess                    0.7.0
    pure-eval                     0.2.2
    pybind11                      2.9.1
    pycparser                     2.21
    pydantic                      1.9.0
    Pygments                      2.11.2
    pyOpenSSL                     22.0.0
    pyparsing                     3.0.7
    pyrsistent                    0.18.1
    PySocks                       1.7.1
    python-dateutil               2.8.2
    pytz                          2021.3
    PyYAML                        6.0
    pyzmq                         22.3.0
    requests                      2.27.1
    scikit-build                  0.13.1
    scipy                         1.8.0
    Send2Trash                    1.8.0
    setuptools                    60.9.3
    six                           1.16.0
    sniffio                       1.2.0
    stack-data                    0.2.0
    sympy                         1.9
    tabulate                      0.8.9
    terminado                     0.13.1
    testpath                      0.5.0
    tomli                         2.0.1
    toolz                         0.11.2
    tornado                       6.1
    traitlets                     5.1.1
    typed-ast                     1.5.2
    typing_extensions             4.1.1
    typing-inspect                0.7.1
    urllib3                       1.26.8
    wcwidth                       0.2.5
    webencodings                  0.5.1
    websocket-client              1.3.1
    websockets                    10.2
    Werkzeug                      2.0.3
    wheel                         0.37.1
    xxhash                        3.0.0
    zipp                          3.7.0

conda list:
    # packages in environment at /Users/jbaker/miniconda/envs/jimenv:
    #
    # Name                    Version                   Build  Channel
    aenum                     3.1.8                    pypi_0    pypi
    anyio                     3.5.0            py39h6e9494a_0    conda-forge
    appnope                   0.1.2            py39h6e9494a_2    conda-forge
    argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
    argon2-cffi-bindings      21.2.0           py39h89e85a6_1    conda-forge
    asttokens                 2.0.5              pyhd8ed1ab_0    conda-forge
    astunparse                1.6.3                    pypi_0    pypi
    attrs                     21.4.0             pyhd3eb1b0_0  
    babel                     2.9.1              pyhd3eb1b0_0  
    backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
    backports                 1.0                        py_2    conda-forge
    backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
    black                     22.1.0             pyhd8ed1ab_0    conda-forge
    bleach                    4.1.0              pyhd3eb1b0_0  
    boltons                   21.0.0                   pypi_0    pypi
    brotli                    1.0.9                h0d85af4_6    conda-forge
    brotli-bin                1.0.9                h0d85af4_6    conda-forge
    brotlipy                  0.7.0           py39h89e85a6_1003    conda-forge
    bzip2                     1.0.8                h0d85af4_4    conda-forge
    ca-certificates           2021.10.8            h033912b_0    conda-forge
    cached-property           1.5.2                    pypi_0    pypi
    cctools                   949.0.1             h9abeeb2_23  
    cctools_osx-64            949.0.1             hc7db93f_23  
    certifi                   2021.10.8        py39h6e9494a_1    conda-forge
    cffi                      1.15.0           py39he338e87_0    conda-forge
    charset-normalizer        2.0.4              pyhd3eb1b0_0  
    clang                     12.0.0               hecd8cb5_2  
    clang-12                  12.0.0          default_hfcad0e5_2  
    clang_osx-64              12.0.0               h7ad7729_2  
    clangxx                   12.0.0          default_hfcad0e5_2  
    click                     8.0.4            py39h6e9494a_0    conda-forge
    cmake                     3.22.2                   pypi_0    pypi
    compiler-rt               12.0.0               hd87ff74_2  
    compiler-rt_osx-64        12.0.0               hfb26b64_2  
    cryptography              36.0.0           py39hf6deb26_0  
    cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
    cytoolz                   0.11.2           py39h89e85a6_1    conda-forge
    dace                      0.11.1                   pypi_0    pypi
    dataclasses               0.8                pyhc8e2a94_3    conda-forge
    debugpy                   1.5.1            py39h9fcab8e_0    conda-forge
    decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
    defusedxml                0.7.1              pyhd3eb1b0_0  
    devtools                  0.8.0                    pypi_0    pypi
    dill                      0.3.4                    pypi_0    pypi
    distro                    1.7.0                    pypi_0    pypi
    entrypoints               0.4                pyhd8ed1ab_0    conda-forge
    executing                 0.8.3              pyhd8ed1ab_0    conda-forge
    flask                     2.0.3                    pypi_0    pypi
    flit-core                 3.7.1              pyhd8ed1ab_0    conda-forge
    freetype                  2.10.4               h4cff582_1    conda-forge
    gfortran                  9.3.0               h768ea0c_15    conda-forge
    gfortran_impl_osx-64      9.3.0               h9cc0e5e_23    conda-forge
    gfortran_osx-64           9.3.0               h18f7dce_15    conda-forge
    giflib                    5.2.1                hbcb3906_2    conda-forge
    gmp                       6.2.1                h2e338ed_0    conda-forge
    gt4py                     0.0.0                    pypi_0    pypi
    icu                       69.1                 he49afe7_0    conda-forge
    idna                      3.3                pyhd3eb1b0_0  
    importlib-metadata        4.8.2            py39hecd8cb5_0  
    importlib_metadata        4.8.2                hd3eb1b0_0  
    ipykernel                 6.9.1            py39h71a6800_0    conda-forge
    ipython                   8.0.1            py39h6e9494a_2    conda-forge
    ipython_genutils          0.2.0              pyhd3eb1b0_1  
    isl                       0.22.1               hb1e8313_2    conda-forge
    itsdangerous              2.1.0                    pypi_0    pypi
    jbig                      2.1               h0d85af4_2003    conda-forge
    jedi                      0.18.1           py39h6e9494a_0    conda-forge
    jinja2                    3.0.2              pyhd3eb1b0_0  
    jpeg                      9e                   h0d85af4_0    conda-forge
    json5                     0.9.6              pyhd3eb1b0_0  
    jsonschema                3.2.0              pyhd3eb1b0_2  
    jupyter_client            7.1.2              pyhd8ed1ab_0    conda-forge
    jupyter_core              4.9.2            py39h6e9494a_0    conda-forge
    jupyter_server            1.13.5             pyhd3eb1b0_0  
    jupyterlab                3.2.9              pyhd3eb1b0_0  
    jupyterlab_pygments       0.1.2                      py_0  
    jupyterlab_server         2.10.3             pyhd3eb1b0_1  
    kiwisolver                1.3.2            py39hf018cea_1    conda-forge
    lcms2                     2.12                 h577c468_0    conda-forge
    ld64                      530                 h20443b4_23  
    ld64_osx-64               530                 h70f3046_23  
    ld_impl_linux-64          2.36.1               h2c3baa3_2    conda-forge
    ldid                      2.1.2                h6a69015_3    conda-forge
    lerc                      3.0                  he49afe7_0    conda-forge
    libblas                   3.9.0           13_osx64_openblas    conda-forge
    libbrotlicommon           1.0.9                h0d85af4_6    conda-forge
    libbrotlidec              1.0.9                h0d85af4_6    conda-forge
    libbrotlienc              1.0.9                h0d85af4_6    conda-forge
    libcblas                  3.9.0           13_osx64_openblas    conda-forge
    libclang-cpp12            12.0.0          default_hfcad0e5_2  
    libcxx                    12.0.1               habf9029_1    conda-forge
    libdeflate                1.10                 h0d85af4_0    conda-forge
    libffi                    3.4.2                h0d85af4_5    conda-forge
    libgfortran               5.0.0           9_3_0_h6c81a4c_23    conda-forge
    libgfortran-devel_osx-64  9.3.0               h6c81a4c_23    conda-forge
    libgfortran-ng            3.0.1                h93005f0_2  
    libgfortran5              9.3.0               h6c81a4c_23    conda-forge
    libiconv                  1.16                 haf1e3a3_0    conda-forge
    liblapack                 3.9.0           13_osx64_openblas    conda-forge
    libllvm12                 12.0.0               h9b2ccf5_3  
    libopenblas               0.3.18          openmp_h3351f45_0    conda-forge
    libpng                    1.6.37               h7cec526_2    conda-forge
    libsodium                 1.0.18               hbcb3906_1    conda-forge
    libtiff                   4.3.0                h17f2ce3_3    conda-forge
    libwebp                   1.2.2                h28dabe5_0    conda-forge
    libwebp-base              1.2.2                h0d85af4_1    conda-forge
    libxcb                    1.13              h0d85af4_1004    conda-forge
    libzlib                   1.2.11            h9173be1_1013    conda-forge
    llvm-openmp               13.0.1               hda6cdc1_0    conda-forge
    llvm-tools                12.0.0               h9b2ccf5_3  
    lz4-c                     1.9.3                he49afe7_1    conda-forge
    mako                      1.1.6                    pypi_0    pypi
    markupsafe                2.1.0            py39h63b48b0_0    conda-forge
    matplotlib                3.4.3            py39h6e9494a_2    conda-forge
    matplotlib-base           3.4.3            py39hb07454d_2    conda-forge
    matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
    mistune                   0.8.4           py39h89e85a6_1005    conda-forge
    mpc                       1.2.1                hbb51d92_0    conda-forge
    mpfr                      4.1.0                h0f52abe_1    conda-forge
    mpmath                    1.2.1                    pypi_0    pypi
    munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
    mypy_extensions           0.4.3            py39h6e9494a_4    conda-forge
    nbclassic                 0.3.5              pyhd3eb1b0_0  
    nbclient                  0.5.11             pyhd3eb1b0_0  
    nbconvert                 6.4.2            py39h6e9494a_0    conda-forge
    nbformat                  5.1.3              pyhd3eb1b0_0  
    ncurses                   6.3                  he49afe7_0    conda-forge
    nest-asyncio              1.5.4              pyhd8ed1ab_0    conda-forge
    networkx                  2.7                      pypi_0    pypi
    notebook                  6.4.8              pyha770c72_0    conda-forge
    numpy                     1.22.2           py39h9d9ce41_0    conda-forge
    openjpeg                  2.4.0                h6e7aa92_1    conda-forge
    openssl                   3.0.0                h0d85af4_2    conda-forge
    packaging                 21.3               pyhd8ed1ab_0    conda-forge
    pandoc                    2.17.1.1             h694c41f_0    conda-forge
    pandocfilters             1.5.0              pyhd3eb1b0_0  
    parso                     0.8.3              pyhd8ed1ab_0    conda-forge
    pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
    pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
    pickleshare               0.7.5                   py_1003    conda-forge
    pillow                    9.0.1            py39hd2c7aa1_2    conda-forge
    pip                       22.0.3             pyhd8ed1ab_0    conda-forge
    platformdirs              2.5.1              pyhd8ed1ab_0    conda-forge
    ply                       3.11                     pypi_0    pypi
    prometheus_client         0.13.1             pyhd3eb1b0_0  
    prompt-toolkit            3.0.27             pyha770c72_0    conda-forge
    pthread-stubs             0.4               hc929b4f_1001    conda-forge
    ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
    pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
    pybind11                  2.9.1                    pypi_0    pypi
    pycparser                 2.21               pyhd3eb1b0_0  
    pydantic                  1.9.0                    pypi_0    pypi
    pygments                  2.11.2             pyhd8ed1ab_0    conda-forge
    pyopenssl                 22.0.0             pyhd3eb1b0_0  
    pyparsing                 3.0.7              pyhd8ed1ab_0    conda-forge
    pyrsistent                0.18.1           py39h89e85a6_0    conda-forge
    pysocks                   1.7.1            py39h6e9494a_4    conda-forge
    python                    3.9.10          hea1dfa3_2_cpython    conda-forge
    python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
    python_abi                3.9                      2_cp39    conda-forge
    pytz                      2021.3             pyhd3eb1b0_0  
    pyyaml                    6.0                      pypi_0    pypi
    pyzmq                     22.3.0           py39h7fec2f1_1    conda-forge
    readline                  8.1                  h05e3726_0    conda-forge
    requests                  2.27.1             pyhd3eb1b0_0  
    scikit-build              0.13.1                   pypi_0    pypi
    scipy                     1.8.0                    pypi_0    pypi
    send2trash                1.8.0              pyhd3eb1b0_1  
    setuptools                60.9.3           py39h6e9494a_0    conda-forge
    six                       1.16.0             pyh6c4a22f_0    conda-forge
    sniffio                   1.2.0            py39h6e9494a_2    conda-forge
    sqlite                    3.37.0               h23a322b_0    conda-forge
    stack_data                0.2.0              pyhd8ed1ab_0    conda-forge
    sympy                     1.9                      pypi_0    pypi
    tabulate                  0.8.9                    pypi_0    pypi
    tapi                      1000.10.8            ha1b3eb9_0  
    terminado                 0.13.1           py39h6e9494a_0    conda-forge
    testpath                  0.5.0              pyhd3eb1b0_0  
    tk                        8.6.12               h5dbffcc_0    conda-forge
    tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
    toolz                     0.11.2             pyhd8ed1ab_0    conda-forge
    tornado                   6.1              py39h89e85a6_2    conda-forge
    traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
    typed-ast                 1.5.2            py39h89e85a6_0    conda-forge
    typing-inspect            0.7.1                    pypi_0    pypi
    typing_extensions         4.1.1              pyha770c72_0    conda-forge
    tzdata                    2021e                he74cb21_0    conda-forge
    urllib3                   1.26.8             pyhd3eb1b0_0  
    wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
    webencodings              0.5.1                      py_1    conda-forge
    websocket-client          1.3.1              pyhd8ed1ab_0    conda-forge
    websockets                10.2                     pypi_0    pypi
    werkzeug                  2.0.3                    pypi_0    pypi
    wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
    xorg-libxau               1.0.9                h35c211d_0    conda-forge
    xorg-libxdmcp             1.1.3                h35c211d_0    conda-forge
    xxhash                    3.0.0                    pypi_0    pypi
    xz                        5.2.5                haf1e3a3_1    conda-forge
    zeromq                    4.3.4                he49afe7_1    conda-forge
    zipp                      3.7.0              pyhd3eb1b0_0  
    zlib                      1.2.11            h9173be1_1013    conda-forge
    zstd                      1.5.2                h582d3a0_0    conda-forge

conda env:
    name: jimenv
    channels:
     - conda-forge
     - defaults
    dependencies:
     - anyio=3.5.0=py39h6e9494a_0
     - appnope=0.1.2=py39h6e9494a_2
     - argon2-cffi=21.3.0=pyhd8ed1ab_0
     - argon2-cffi-bindings=21.2.0=py39h89e85a6_1
     - asttokens=2.0.5=pyhd8ed1ab_0
     - attrs=21.4.0=pyhd3eb1b0_0
     - babel=2.9.1=pyhd3eb1b0_0
     - backcall=0.2.0=pyh9f0ad1d_0
     - backports=1.0=py_2
     - backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
     - black=22.1.0=pyhd8ed1ab_0
     - bleach=4.1.0=pyhd3eb1b0_0
     - brotli=1.0.9=h0d85af4_6
     - brotli-bin=1.0.9=h0d85af4_6
     - brotlipy=0.7.0=py39h89e85a6_1003
     - bzip2=1.0.8=h0d85af4_4
     - ca-certificates=2021.10.8=h033912b_0
     - cctools=949.0.1=h9abeeb2_23
     - cctools_osx-64=949.0.1=hc7db93f_23
     - certifi=2021.10.8=py39h6e9494a_1
     - cffi=1.15.0=py39he338e87_0
     - charset-normalizer=2.0.4=pyhd3eb1b0_0
     - clang=12.0.0=hecd8cb5_2
     - clang-12=12.0.0=default_hfcad0e5_2
     - clang_osx-64=12.0.0=h7ad7729_2
     - clangxx=12.0.0=default_hfcad0e5_2
     - click=8.0.4=py39h6e9494a_0
     - compiler-rt=12.0.0=hd87ff74_2
     - compiler-rt_osx-64=12.0.0=hfb26b64_2
     - cryptography=36.0.0=py39hf6deb26_0
     - cycler=0.11.0=pyhd8ed1ab_0
     - cytoolz=0.11.2=py39h89e85a6_1
     - dataclasses=0.8=pyhc8e2a94_3
     - debugpy=1.5.1=py39h9fcab8e_0
     - decorator=5.1.1=pyhd8ed1ab_0
     - defusedxml=0.7.1=pyhd3eb1b0_0
     - entrypoints=0.4=pyhd8ed1ab_0
     - executing=0.8.3=pyhd8ed1ab_0
     - flit-core=3.7.1=pyhd8ed1ab_0
     - freetype=2.10.4=h4cff582_1
     - gfortran=9.3.0=h768ea0c_15
     - gfortran_impl_osx-64=9.3.0=h9cc0e5e_23
     - gfortran_osx-64=9.3.0=h18f7dce_15
     - giflib=5.2.1=hbcb3906_2
     - gmp=6.2.1=h2e338ed_0
     - icu=69.1=he49afe7_0
     - idna=3.3=pyhd3eb1b0_0
     - importlib-metadata=4.8.2=py39hecd8cb5_0
     - importlib_metadata=4.8.2=hd3eb1b0_0
     - ipykernel=6.9.1=py39h71a6800_0
     - ipython=8.0.1=py39h6e9494a_2
     - ipython_genutils=0.2.0=pyhd3eb1b0_1
     - isl=0.22.1=hb1e8313_2
     - jbig=2.1=h0d85af4_2003
     - jedi=0.18.1=py39h6e9494a_0
     - jinja2=3.0.2=pyhd3eb1b0_0
     - jpeg=9e=h0d85af4_0
     - json5=0.9.6=pyhd3eb1b0_0
     - jsonschema=3.2.0=pyhd3eb1b0_2
     - jupyter_client=7.1.2=pyhd8ed1ab_0
     - jupyter_core=4.9.2=py39h6e9494a_0
     - jupyter_server=1.13.5=pyhd3eb1b0_0
     - jupyterlab=3.2.9=pyhd3eb1b0_0
     - jupyterlab_pygments=0.1.2=py_0
     - jupyterlab_server=2.10.3=pyhd3eb1b0_1
     - kiwisolver=1.3.2=py39hf018cea_1
     - lcms2=2.12=h577c468_0
     - ld64=530=h20443b4_23
     - ld64_osx-64=530=h70f3046_23
     - ld_impl_linux-64=2.36.1=h2c3baa3_2
     - ldid=2.1.2=h6a69015_3
     - lerc=3.0=he49afe7_0
     - libblas=3.9.0=13_osx64_openblas
     - libbrotlicommon=1.0.9=h0d85af4_6
     - libbrotlidec=1.0.9=h0d85af4_6
     - libbrotlienc=1.0.9=h0d85af4_6
     - libcblas=3.9.0=13_osx64_openblas
     - libclang-cpp12=12.0.0=default_hfcad0e5_2
     - libcxx=12.0.1=habf9029_1
     - libdeflate=1.10=h0d85af4_0
     - libffi=3.4.2=h0d85af4_5
     - libgfortran=5.0.0=9_3_0_h6c81a4c_23
     - libgfortran-devel_osx-64=9.3.0=h6c81a4c_23
     - libgfortran-ng=3.0.1=h93005f0_2
     - libgfortran5=9.3.0=h6c81a4c_23
     - libiconv=1.16=haf1e3a3_0
     - liblapack=3.9.0=13_osx64_openblas
     - libllvm12=12.0.0=h9b2ccf5_3
     - libopenblas=0.3.18=openmp_h3351f45_0
     - libpng=1.6.37=h7cec526_2
     - libsodium=1.0.18=hbcb3906_1
     - libtiff=4.3.0=h17f2ce3_3
     - libwebp=1.2.2=h28dabe5_0
     - libwebp-base=1.2.2=h0d85af4_1
     - libxcb=1.13=h0d85af4_1004
     - libzlib=1.2.11=h9173be1_1013
     - llvm-openmp=13.0.1=hda6cdc1_0
     - llvm-tools=12.0.0=h9b2ccf5_3
     - lz4-c=1.9.3=he49afe7_1
     - markupsafe=2.1.0=py39h63b48b0_0
     - matplotlib=3.4.3=py39h6e9494a_2
     - matplotlib-base=3.4.3=py39hb07454d_2
     - matplotlib-inline=0.1.3=pyhd8ed1ab_0
     - mistune=0.8.4=py39h89e85a6_1005
     - mpc=1.2.1=hbb51d92_0
     - mpfr=4.1.0=h0f52abe_1
     - munkres=1.1.4=pyh9f0ad1d_0
     - mypy_extensions=0.4.3=py39h6e9494a_4
     - nbclassic=0.3.5=pyhd3eb1b0_0
     - nbclient=0.5.11=pyhd3eb1b0_0
     - nbconvert=6.4.2=py39h6e9494a_0
     - nbformat=5.1.3=pyhd3eb1b0_0
     - ncurses=6.3=he49afe7_0
     - nest-asyncio=1.5.4=pyhd8ed1ab_0
     - notebook=6.4.8=pyha770c72_0
     - numpy=1.22.2=py39h9d9ce41_0
     - openjpeg=2.4.0=h6e7aa92_1
     - openssl=3.0.0=h0d85af4_2
     - packaging=21.3=pyhd8ed1ab_0
     - pandoc=2.17.1.1=h694c41f_0
     - pandocfilters=1.5.0=pyhd3eb1b0_0
     - parso=0.8.3=pyhd8ed1ab_0
     - pathspec=0.9.0=pyhd8ed1ab_0
     - pexpect=4.8.0=pyh9f0ad1d_2
     - pickleshare=0.7.5=py_1003
     - pillow=9.0.1=py39hd2c7aa1_2
     - pip=22.0.3=pyhd8ed1ab_0
     - platformdirs=2.5.1=pyhd8ed1ab_0
     - prometheus_client=0.13.1=pyhd3eb1b0_0
     - prompt-toolkit=3.0.27=pyha770c72_0
     - pthread-stubs=0.4=hc929b4f_1001
     - ptyprocess=0.7.0=pyhd3deb0d_0
     - pure_eval=0.2.2=pyhd8ed1ab_0
     - pycparser=2.21=pyhd3eb1b0_0
     - pygments=2.11.2=pyhd8ed1ab_0
     - pyopenssl=22.0.0=pyhd3eb1b0_0
     - pyparsing=3.0.7=pyhd8ed1ab_0
     - pyrsistent=0.18.1=py39h89e85a6_0
     - pysocks=1.7.1=py39h6e9494a_4
     - python=3.9.10=hea1dfa3_2_cpython
     - python-dateutil=2.8.2=pyhd8ed1ab_0
     - python_abi=3.9=2_cp39
     - pytz=2021.3=pyhd3eb1b0_0
     - pyzmq=22.3.0=py39h7fec2f1_1
     - readline=8.1=h05e3726_0
     - requests=2.27.1=pyhd3eb1b0_0
     - send2trash=1.8.0=pyhd3eb1b0_1
     - setuptools=60.9.3=py39h6e9494a_0
     - six=1.16.0=pyh6c4a22f_0
     - sniffio=1.2.0=py39h6e9494a_2
     - sqlite=3.37.0=h23a322b_0
     - stack_data=0.2.0=pyhd8ed1ab_0
     - tapi=1000.10.8=ha1b3eb9_0
     - terminado=0.13.1=py39h6e9494a_0
     - testpath=0.5.0=pyhd3eb1b0_0
     - tk=8.6.12=h5dbffcc_0
     - tomli=2.0.1=pyhd8ed1ab_0
     - toolz=0.11.2=pyhd8ed1ab_0
     - tornado=6.1=py39h89e85a6_2
     - traitlets=5.1.1=pyhd8ed1ab_0
     - typed-ast=1.5.2=py39h89e85a6_0
     - typing_extensions=4.1.1=pyha770c72_0
     - tzdata=2021e=he74cb21_0
     - urllib3=1.26.8=pyhd3eb1b0_0
     - wcwidth=0.2.5=pyh9f0ad1d_2
     - webencodings=0.5.1=py_1
     - websocket-client=1.3.1=pyhd8ed1ab_0
     - wheel=0.37.1=pyhd8ed1ab_0
     - xorg-libxau=1.0.9=h35c211d_0
     - xorg-libxdmcp=1.1.3=h35c211d_0
     - xz=5.2.5=haf1e3a3_1
     - zeromq=4.3.4=he49afe7_1
     - zipp=3.7.0=pyhd3eb1b0_0
     - zlib=1.2.11=h9173be1_1013
     - zstd=1.5.2=h582d3a0_0
     - pip:
       - aenum==3.1.8
       - astunparse==1.6.3
       - boltons==21.0.0
       - cached-property==1.5.2
       - cmake==3.22.2
       - dace==0.11.1
       - devtools==0.8.0
       - dill==0.3.4
       - distro==1.7.0
       - flask==2.0.3
       - gt4py==0.0.0
       - itsdangerous==2.1.0
       - mako==1.1.6
       - mpmath==1.2.1
       - networkx==2.7
       - ply==3.11
       - pybind11==2.9.1
       - pydantic==1.9.0
       - pyyaml==6.0
       - scikit-build==0.13.1
       - scipy==1.8.0
       - sympy==1.9
       - tabulate==0.8.9
       - typing-inspect==0.7.1
       - websockets==10.2
       - werkzeug==2.0.3
       - xxhash==3.0.0
    prefix: /Users/jbaker/miniconda/envs/jimenv
Command Line Output

Browser Output

Uncaught (in promise) DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method.
    at Object.w (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:894301)
    at g.render (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:903223)
    at g.renderModel (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:900951)
    at j._setOutput (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:865641)
    at j.onModelChanged (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:863857)
    at m (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:1419176)
    at Object.l [as emit] (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:1418836)
    at e.emit (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:1417081)
    at c._onListChanged (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:860074)
    at m (http://localhost:8888/static/lab/jlab_core.0adf13f7678b3af0da97.js?v=0adf13f7678b3af0da97:2:1419176)

welcome[bot] commented 2 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

jbaksta commented 2 years ago

jupyter lab --debug output here: https://gist.github.com/jbaksta/8a1bfa61a78997023f384f1a27cba82f

JasonWeill commented 2 years ago

Thanks for filing this issue! I was unable to reproduce this using the attached notebook because I was unable to install gt4py using pip on macOS Big Sur. Can you reference a different notebook that demonstrates the bug?

jbaksta commented 2 years ago

Not particularly. This has been the only notebook that I've seen demonstrate this. Indeed, the gt4py package is challenging. If I supplied a Dockerfile that demonstrated it, would that be useful?

JasonWeill commented 2 years ago

I might be able to look at a Dockerfile. Thanks!

jbaksta commented 2 years ago

Here is a basic Dockerfile that demonstrates the issue I believe. Tweaked the environment.yml file for Linux rather than MacOS.

FROM fedora:latest

EXPOSE 8888

RUN \
  dnf -y makecache && \
  dnf -y upgrade  && \
  dnf -y install gcc gcc-c++ gcc-gfortran autoconf automake cmake git

RUN \
  curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
  /bin/sh ./Miniconda3-latest-Linux-x86_64.sh -p /opt/mc3 -b && \
  ln -s /opt/mc3/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
  . /opt/mc3/etc/profile.d/conda.sh && \
  conda activate base && \
  conda install -y -c conda-forge mamba

RUN \
  curl -o /tmp/environment.yml 'https://gist.githubusercontent.com/jbaksta/aac9ebd419669a83ea60c4199509c70e/raw/af085ffa8e425a1db16323f3da500f9869e763c1/JupyterLab-gt4py-environment.yml'
RUN \
  . /etc/profile.d/conda.sh && \
  mamba env create -n gt4py -f /tmp/environment.yml

RUN \
  /usr/bin/echo ". /opt/mc3/etc/profile.d/conda.sh; conda activate gt4py; jupyter lab --allow-root --ip=0.0.0.0 " > /usr/local/bin/jupyterlab.sh

RUN \
  cd /tmp/ && \
  curl -O 'https://raw.githubusercontent.com/GridTools/gt4py/master/examples/demo_burgers.ipynb'

CMD ["/bin/bash","/usr/local/bin/jupyterlab.sh"]

docker build -t jlab-gt4py . docker run -it -h jlab -p 8888:8888 jlab-gt4py

The notebook file is stored in /tmp.

JasonWeill commented 2 years ago

Thank you for sharing this Docker file! I've been able to run it locally and reproduce the error. I'm still not exactly sure where the "Javascript Error" is coming from, as this string (nor "Javascript" with a capital J and lowercase s) occurs in the JupyterLab codebase. I tried to look at the gridtools4py code, but that link returns a 404.

I will accept this bug into the project by removing the "Needs Triage" tag. Thanks again for your help!

jbaksta commented 2 years ago

Here is the gt4py repo: https://github.com/GridTools/gt4py. Great. If I can help out with more information, let me know. I suppose I assumed that message comes from the Node interpreter, but unsure.

JasonWeill commented 2 years ago

I've seen other examples on the Discourse forums of "Javascript Error", but no leads on this particular issue.

krassowski commented 2 years ago

I can investigate if you could prepare a binder in which it is reproducible for that dockerfile (https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html, https://github.com/binder-examples/minimal-dockerfile).

jbaksta commented 2 years ago

Sure, here it is: https://mybinder.org/v2/gh/jbaksta/jlab-javascript-gt4py.git/HEAD

krassowski commented 2 years ago

It comes from a part of the codebase familiar to me. Your code produces the following traceback:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [6], in <cell line: 20>()
      8 externals={
      9     "absolute_value": absolute_value,
     10     "advection_x": advection_x,
   (...)
     15     "diffusion": diffusion
     16 }
     18 start_time = time.time()
     20 @gtscript.stencil(backend=backend, externals=externals, rebuild=rebuild, **backend_opts)
---> 21 def rk_stage(
     22     in_u_now: gtscript.Field[dtype],
     23     in_v_now: gtscript.Field[dtype],
     24     in_u_tmp: gtscript.Field[dtype],
     25     in_v_tmp: gtscript.Field[dtype],
     26     out_u: gtscript.Field[dtype],
     27     out_v: gtscript.Field[dtype],
     28     *,
     29     dt: float,
     30     dx: float,
     31     dy: float,
     32     mu: float
     33 ):
     34     with computation(PARALLEL), interval(...):
     35         adv_u, adv_v = advection(dx=dx, dy=dy, u=in_u_tmp, v=in_v_tmp)

File /opt/mc3/envs/gt4py/lib/python3.9/site-packages/gt4py/gtscript.py:276, in stencil.<locals>._decorator(definition_func)
    273         definition_func = definition_func.__call__
    275 original_annotations = _set_arg_dtypes(definition_func, dtypes or {})
--> 276 out = gt_loader.gtscript_loader(
    277     definition_func,
    278     backend=backend,
    279     build_options=build_options,
    280     externals=externals or {},
    281 )
    282 setattr(definition_func, "__annotations__", original_annotations)
    283 return out

File /opt/mc3/envs/gt4py/lib/python3.9/site-packages/gt4py/loader.py:72, in gtscript_loader(definition_func, backend, build_options, externals)
     70 if not build_options.name:
     71     build_options.name = f"{definition_func.__name__}"
---> 72 stencil_class = load_stencil("gtscript", backend, definition_func, externals, build_options)
     74 return stencil_class()

File /opt/mc3/envs/gt4py/lib/python3.9/site-packages/gt4py/loader.py:48, in load_stencil(frontend_name, backend_name, definition_func, externals, build_options)
     46 backend_cls = gt_backend.from_name(backend_name)
     47 if backend_cls is None:
---> 48     raise ValueError("Unknown backend name ({name})".format(name=backend_name))
     50 frontend = gt_frontend.from_name(frontend_name)
     51 if frontend is None:

ValueError: Unknown backend name (numpy)

And the rendering logic modified in #11272 fails on:

https://github.com/jupyterlab/jupyterlab/blob/b8df068b2eb694cb93ec281526e6e131031f7fcd/packages/rendermime/src/renderers.ts#L646

From a cursory glance, the problem is in:

https://github.com/jupyterlab/jupyterlab/blob/b8df068b2eb694cb93ec281526e6e131031f7fcd/packages/rendermime/src/renderers.ts#L635-L636

Namely, Node.TEXT_NODE is undefined (instead of 3). There should be no reason for it to be undefined: the browser support is all green on https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType.

Instead what happens, is the Node gets overridden by Node from SDFGElements from spcl dace/webclient. It looks like a third-party javascript code is injected into the page shadowing the native web objects. I see that your environment contains dace dependency - it appears that they are leaking their objects which is neither safe nor compatible with other code, here:

https://github.com/spcl/dace-webclient/blob/01c5cc42c61f5d9aaf00c261284f6a12108b05fd/renderer_elements.js#L247

jbaksta commented 2 years ago

Okay. Thanks. I'll see if I can open an issue there as well and see if something can be done. This all makes sense as this is the only time I've seen an error of this sort in Jupyter Lab.

krassowski commented 2 years ago

Removing dace should solve the problem. You may want to report it over on https://github.com/spcl/dace (the least they could do would be to rename the Node class so that it does not collide with the built-in Node from DOM, but ideally their objects should not be added to the global namespace at all.

We could possibly hard-code the value to 3 to be more resilient to violations like this (pull request welcome), but once the fundamental DOM types (like Element, Node, Document, etc) get overridden no web application can be expected to work correctly.

tbennun commented 2 years ago

Thanks for narrowing it down to our project! I'm not sure which version is used here, since we now try to reduce global namespace cluttering to a minimum (we only export two specifically-named classes now).

In any case, it would be good for us to know: what is the recommended way to export classes to use for custom _repr_html_ outputs (that is, without using %magic)?

jbaksta commented 2 years ago

I think we can close this out as updating to the latest dace-webclient solves the issue.

jasongrout commented 2 years ago

I think we can close this out as updating to the latest dace-webclient solves the issue.

Thanks!