Can't install and use properly pythreejs

I installed pythreejs following the instructions on the official website

pip3 install pythreejs jupyter nbextension install --user --py pythreejs jupyter nbextension enable --user --py pythreejs 

Looking at the output of jupyter nbextension list, everything looks fine:

Known nbextensions: config dir: /home/gael/.jupyter/nbconfig notebook section jupyter-threejs/extension enabled - Validating: OK 

But when I start the server (jupyter notebook), create a new (Python3) notebook, and try to run the example code

from pythreejs import * import numpy as np from IPython.display import display from ipywidgets import HTML, Text, Output, VBox from traitlets import link, dlink ball = Mesh(geometry=SphereGeometry(radius=1, widthSegments=32, heightSegments=24), material=MeshLambertMaterial(color='red'), position=[2, 1, 0]) c = PerspectiveCamera(position=[0, 5, 5], up=[0, 1, 0], children=[DirectionalLight(color='white', position=[3, 5, 1], intensity=0.5)]) scene = Scene(children=[ball, c, AmbientLight(color='#777777')]) renderer = Renderer(camera=c, scene=scene, controls=[OrbitControls(controlling=c)]) display(renderer) 

from pythreejs' official repository, it does not show me a visualization window embedded in the page. Instead, below the cell it displays a hash:

UmVuZGVyZXIoY2FtZXJhPVBlcnNwZWN0aXZlQ2FtZXJhKGNoaWxkcmVuPShEaXJlY3Rpb25hbExpZ2h0KGNvbG9yPSd3aGl0ZScsIGludGVuc2l0eT0wLjUsIHBvc2l0aW9uPSgzLjAsIDUuMCzigKY= 

I also tried with jupyter lab, and with Python2, and it had exactly the same behavior.

What am I missing?

System: Ubuntu 18.04 Jupyter Notebook version: 5.7.8

1 Answer

Looking more closely at jupyter's output in the console, I read:

[W 18:55:45.544 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20200107185531 (127.0.0.1) 14.69ms referer= 

Following advice for this error I do:

jupyter nbextension enable --py widgetsnbextension 

then start the server: and pythreejs works!!

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like