Closed nlgranger closed 2 years ago
Apparently one simply needs to manually enable the jupyter extension:
jupyter nbextension install --py --user k3d
jupyter nbextension enable --py --user k3d
I'm gonna leave this issue open till the documentation mentions it if you don't mind.
Hi Nicolas,
while the commands you mentioned are not necessary in all circumstances (since Notebook 7.x there is a mechanism for auto-installation; I think the conda-forge version also doesn't need it).
However, these commands shouldn't hurt in any case, so I added them to the README. This will be merged to main
in the next release, so stay tuned.
Also, we were getting questions about this earlier, especially after users upgraded their K3D and got a Python/JS version mismatch. So I also put there a note about upgrade.
Great, thank you (and thanks for this project too, it works really well and is simple to use).
Based on 86cucv's comment about running k3d within a docker notebook, I've tried the same but within a colab notebook.
I run!jupyter nbextension install --py --user k3d
and !jupyter nbextension enable --py --user k3d
and the validations both show OK.
I then run this code:
from k3d.helpers import download
import k3d
plot = k3d.plot()
filename = download('https://upload.wikimedia.org/wikipedia/commons/a/af/Asad_Al-Lat.stl')
plot += k3d.stl(open(filename, 'rb').read())
plot.display()
which should give me this:
however, I only see this:
Any idea why the stl doen't get "attached" to the viewer within colab?
Hi @ChHarding
As We explain here: https://github.com/K3D-tools/K3D-jupyter?tab=readme-ov-file#google-colab
For Google Colab you need to activate custom widgets and switch k3d to text protocol:
import k3d
from google.colab import output
output.enable_custom_widget_manager()
k3d.switch_to_text_protocol()
The reason for that is that colab has no support to binary websockets
Thank you but that still doesn't work. I read up on how to activate custom widgets but this might be wrong(?) Here's what I'm doing:
Any idea what I'm doing wrong?
Thanks!
When installing k3d via pip in a clean conda environment and using jupyter notebook, the plot won't show up and the console reports:
k3d works when installed via conda using conda-forge channel.