I tried both
plot3d(sin(pi * sqrt(x**2 + y**2)) / sqrt(x**2 + y**2), (x, -5, 5), (y, -5, 5), viewer='threejs')
...
p1 = sphere(color='red', opacity='.5')
p2 = sphere((-1,-1,1), color='cyan', opacity='.3')
p3 = sphere((1,-1,-1), color='yellow', opacity='.7')
show(p1 + p2 + p3, viewer='threejs')
Again on both jupyter notebook and jupyterlab, on both Safari and Chrome. Are you sure there isn’t other dependencies?
I checked the HTML console and found this:
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (preact.min.js.map, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (index.js.map, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (preact-compat.min.js.map, line 0)
Are there any jupyter widgets that I should install?
I couldn't install sage on macOS Mojave, I'm guessing it isn't compatible with Mojave yet.
--
sage: y = var('y')
sage: plot3d(x * y, (x, -1, 1), (y, -1, 1), viewer='threejs')
Launched html viewer for Graphics3d Object
I didn’t see anything since I’m remote ssh. I tried both ssh -X
and ssh -Y
but they doesn’t work.
I don’t have a local machine that has a working sage yet. So can’t test that.
Thanks.
I tried to install threejs by jupyter labextension install jupyter-threejs
but it still doesn’t work. I tried on both jupyter and jupyterlab. I didn’t tried symlinking the directories you mentioned though, because I don’t want to mess up the virtual environments created by conda (my jupyterlab environment is created using conda.)
Currently it's like this: on an ArchLinux machine, install sage through pacman, and install the sagemath kernel to my jupyterlab hub. And then through the jupyterlab-hub I remote it and use the sagemath kernel and typed the above commands.I'm guessing it requires some widgets to be installed in jupyter for them to work. Since I'm not using the Sage notebook interface but a Jupyterlab-hub instance that has the sagemath kernel installed.
Thanks all for the comments. In the end I choose this temporary fix plot3d(sin(pi * sqrt(x**2 + y**2)) / sqrt(x**2 + y**2), (x, -5, 5), (y, -5, 5), viewer='threejs', online=True)
. I prefer to stick to jupyterlab hub and using conda to manage it so I didn’t try symlink those from sage in the jupyterlab environment.
Regarding the three.js shipped by Arch, may be it didn’t work. But it isn’t the original of the problem I’m experiencing since in the browser’s console it clearly indicates the three.js cannot be found. I tried to install three.js the “jupyter way”, i.e. jupyter labextension install jupyter-threejs
, but it didn’t work for both jupyterlab and jupyter notebook.