Closed jbaksta closed 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.
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:
jupyter lab --debug
output here: https://gist.github.com/jbaksta/8a1bfa61a78997023f384f1a27cba82f
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?
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?
I might be able to look at a Dockerfile. Thanks!
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
.
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!
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.
I've seen other examples on the Discourse forums of "Javascript Error", but no leads on this particular issue.
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).
Sure, here it is: https://mybinder.org/v2/gh/jbaksta/jlab-javascript-gt4py.git/HEAD
It comes from a part of the codebase familiar to me. Your code produces the following traceback:
[0;31m---------------------------------------------------------------------------[0m
[0;31mValueError[0m Traceback (most recent call last)
Input [0;32mIn [6][0m, in [0;36m<cell line: 20>[0;34m()[0m
[1;32m 8[0m externals[38;5;241m=[39m{
[1;32m 9[0m [38;5;124m"[39m[38;5;124mabsolute_value[39m[38;5;124m"[39m: absolute_value,
[1;32m 10[0m [38;5;124m"[39m[38;5;124madvection_x[39m[38;5;124m"[39m: advection_x,
[0;32m (...)[0m
[1;32m 15[0m [38;5;124m"[39m[38;5;124mdiffusion[39m[38;5;124m"[39m: diffusion
[1;32m 16[0m }
[1;32m 18[0m start_time [38;5;241m=[39m time[38;5;241m.[39mtime()
[1;32m 20[0m [38;5;129;43m@gtscript[39;49m[38;5;241;43m.[39;49m[43mstencil[49m[43m([49m[43mbackend[49m[38;5;241;43m=[39;49m[43mbackend[49m[43m,[49m[43m [49m[43mexternals[49m[38;5;241;43m=[39;49m[43mexternals[49m[43m,[49m[43m [49m[43mrebuild[49m[38;5;241;43m=[39;49m[43mrebuild[49m[43m,[49m[43m [49m[38;5;241;43m*[39;49m[38;5;241;43m*[39;49m[43mbackend_opts[49m[43m)[49m
[0;32m---> 21[0m [38;5;28;43;01mdef[39;49;00m[43m [49m[38;5;21;43mrk_stage[39;49m[43m([49m
[1;32m 22[0m [43m [49m[43min_u_now[49m[43m:[49m[43m [49m[43mgtscript[49m[38;5;241;43m.[39;49m[43mField[49m[43m[[49m[43mdtype[49m[43m][49m[43m,[49m
[1;32m 23[0m [43m [49m[43min_v_now[49m[43m:[49m[43m [49m[43mgtscript[49m[38;5;241;43m.[39;49m[43mField[49m[43m[[49m[43mdtype[49m[43m][49m[43m,[49m
[1;32m 24[0m [43m [49m[43min_u_tmp[49m[43m:[49m[43m [49m[43mgtscript[49m[38;5;241;43m.[39;49m[43mField[49m[43m[[49m[43mdtype[49m[43m][49m[43m,[49m
[1;32m 25[0m [43m [49m[43min_v_tmp[49m[43m:[49m[43m [49m[43mgtscript[49m[38;5;241;43m.[39;49m[43mField[49m[43m[[49m[43mdtype[49m[43m][49m[43m,[49m
[1;32m 26[0m [43m [49m[43mout_u[49m[43m:[49m[43m [49m[43mgtscript[49m[38;5;241;43m.[39;49m[43mField[49m[43m[[49m[43mdtype[49m[43m][49m[43m,[49m
[1;32m 27[0m [43m [49m[43mout_v[49m[43m:[49m[43m [49m[43mgtscript[49m[38;5;241;43m.[39;49m[43mField[49m[43m[[49m[43mdtype[49m[43m][49m[43m,[49m
[1;32m 28[0m [43m [49m[38;5;241;43m*[39;49m[43m,[49m
[1;32m 29[0m [43m [49m[43mdt[49m[43m:[49m[43m [49m[38;5;28;43mfloat[39;49m[43m,[49m
[1;32m 30[0m [43m [49m[43mdx[49m[43m:[49m[43m [49m[38;5;28;43mfloat[39;49m[43m,[49m
[1;32m 31[0m [43m [49m[43mdy[49m[43m:[49m[43m [49m[38;5;28;43mfloat[39;49m[43m,[49m
[1;32m 32[0m [43m [49m[43mmu[49m[43m:[49m[43m [49m[38;5;28;43mfloat[39;49m
[1;32m 33[0m [43m)[49m[43m:[49m
[1;32m 34[0m [43m [49m[38;5;28;43;01mwith[39;49;00m[43m [49m[43mcomputation[49m[43m([49m[43mPARALLEL[49m[43m)[49m[43m,[49m[43m [49m[43minterval[49m[43m([49m[38;5;241;43m.[39;49m[38;5;241;43m.[39;49m[38;5;241;43m.[39;49m[43m)[49m[43m:[49m
[1;32m 35[0m [43m [49m[43madv_u[49m[43m,[49m[43m [49m[43madv_v[49m[43m [49m[38;5;241;43m=[39;49m[43m [49m[43madvection[49m[43m([49m[43mdx[49m[38;5;241;43m=[39;49m[43mdx[49m[43m,[49m[43m [49m[43mdy[49m[38;5;241;43m=[39;49m[43mdy[49m[43m,[49m[43m [49m[43mu[49m[38;5;241;43m=[39;49m[43min_u_tmp[49m[43m,[49m[43m [49m[43mv[49m[38;5;241;43m=[39;49m[43min_v_tmp[49m[43m)[49m
File [0;32m/opt/mc3/envs/gt4py/lib/python3.9/site-packages/gt4py/gtscript.py:276[0m, in [0;36mstencil.<locals>._decorator[0;34m(definition_func)[0m
[1;32m 273[0m definition_func [38;5;241m=[39m definition_func[38;5;241m.[39m[38;5;21m__call__[39m
[1;32m 275[0m original_annotations [38;5;241m=[39m _set_arg_dtypes(definition_func, dtypes [38;5;129;01mor[39;00m {})
[0;32m--> 276[0m out [38;5;241m=[39m [43mgt_loader[49m[38;5;241;43m.[39;49m[43mgtscript_loader[49m[43m([49m
[1;32m 277[0m [43m [49m[43mdefinition_func[49m[43m,[49m
[1;32m 278[0m [43m [49m[43mbackend[49m[38;5;241;43m=[39;49m[43mbackend[49m[43m,[49m
[1;32m 279[0m [43m [49m[43mbuild_options[49m[38;5;241;43m=[39;49m[43mbuild_options[49m[43m,[49m
[1;32m 280[0m [43m [49m[43mexternals[49m[38;5;241;43m=[39;49m[43mexternals[49m[43m [49m[38;5;129;43;01mor[39;49;00m[43m [49m[43m{[49m[43m}[49m[43m,[49m
[1;32m 281[0m [43m[49m[43m)[49m
[1;32m 282[0m [38;5;28msetattr[39m(definition_func, [38;5;124m"[39m[38;5;124m__annotations__[39m[38;5;124m"[39m, original_annotations)
[1;32m 283[0m [38;5;28;01mreturn[39;00m out
File [0;32m/opt/mc3/envs/gt4py/lib/python3.9/site-packages/gt4py/loader.py:72[0m, in [0;36mgtscript_loader[0;34m(definition_func, backend, build_options, externals)[0m
[1;32m 70[0m [38;5;28;01mif[39;00m [38;5;129;01mnot[39;00m build_options[38;5;241m.[39mname:
[1;32m 71[0m build_options[38;5;241m.[39mname [38;5;241m=[39m [38;5;124mf[39m[38;5;124m"[39m[38;5;132;01m{[39;00mdefinition_func[38;5;241m.[39m[38;5;18m__name__[39m[38;5;132;01m}[39;00m[38;5;124m"[39m
[0;32m---> 72[0m stencil_class [38;5;241m=[39m [43mload_stencil[49m[43m([49m[38;5;124;43m"[39;49m[38;5;124;43mgtscript[39;49m[38;5;124;43m"[39;49m[43m,[49m[43m [49m[43mbackend[49m[43m,[49m[43m [49m[43mdefinition_func[49m[43m,[49m[43m [49m[43mexternals[49m[43m,[49m[43m [49m[43mbuild_options[49m[43m)[49m
[1;32m 74[0m [38;5;28;01mreturn[39;00m stencil_class()
File [0;32m/opt/mc3/envs/gt4py/lib/python3.9/site-packages/gt4py/loader.py:48[0m, in [0;36mload_stencil[0;34m(frontend_name, backend_name, definition_func, externals, build_options)[0m
[1;32m 46[0m backend_cls [38;5;241m=[39m gt_backend[38;5;241m.[39mfrom_name(backend_name)
[1;32m 47[0m [38;5;28;01mif[39;00m backend_cls [38;5;129;01mis[39;00m [38;5;28;01mNone[39;00m:
[0;32m---> 48[0m [38;5;28;01mraise[39;00m [38;5;167;01mValueError[39;00m([38;5;124m"[39m[38;5;124mUnknown backend name ([39m[38;5;132;01m{name}[39;00m[38;5;124m)[39m[38;5;124m"[39m[38;5;241m.[39mformat(name[38;5;241m=[39mbackend_name))
[1;32m 50[0m frontend [38;5;241m=[39m gt_frontend[38;5;241m.[39mfrom_name(frontend_name)
[1;32m 51[0m [38;5;28;01mif[39;00m frontend [38;5;129;01mis[39;00m [38;5;28;01mNone[39;00m:
[0;31mValueError[0m: Unknown backend name (numpy)
And the rendering logic modified in #11272 fails on:
From a cursory glance, the problem is in:
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:
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.
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.
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)?
I think we can close this out as updating to the latest dace-webclient solves the issue.
I think we can close this out as updating to the latest dace-webclient solves the issue.
Thanks!
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.Reproduce
Create a proper conda environment.
Then run this example: https://github.com/GridTools/gt4py/blob/master/examples/demo_burgers.ipynb
Expected behavior
No JavaScript error
Context
Troubleshoot Output
Command Line Output
Browser Output