pythreejs k3d ... and others

339 views
Skip to first unread message

Henri Girard

unread,
May 4, 2017, 4:47:30 AM5/4/17
to Project Jupyter
Hi,
Jupyter nbextension works fine :
jupyter nbextension enable --py --sys-prefix widgetsnbextension
Apparently that's the only one :
After installing pythreejs with pip successfully this command failed :
jupyter nbextension enable --py --sys-prefix pythreejs

    return __import__(parts[0])
ImportError: No module named pythreejs

I tried to do it with others : k3d

Only flatsurf succeeded

Any help ?

Regards
Henri


Jason Grout

unread,
May 5, 2017, 11:18:53 AM5/5/17
to Project Jupyter
Did you do the following too?

jupyter nbextension install --py --sys-prefix pythreejs

Thanks,

Jason

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/c534ca79-f156-4805-b78b-ffe7d7b0e500%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Henri Girard

unread,
May 12, 2017, 4:07:24 AM5/12/17
to Project Jupyter

Henri Girard

unread,
May 12, 2017, 4:09:44 AM5/12/17
to Project Jupyter


Le jeudi 4 mai 2017 10:47:30 UTC+2, Henri Girard a écrit :
Yes ... Sorry for double mail
 
Installing /home/pi/sage/pythreejs/pythreejs/static -> jupyter-threejs
Symlinking: /home/pi/sage/local/share/jupyter/nbextensions/jupyter-threejs -> /home/pi/sage/pythreejs/pythreejs/static
- Validating: OK

    To initialize this nbextension in the browser every time the notebook (or other app) loads:
    
          jupyter nbextension enable pythreejs --py --sys-prefix
    
Enabling notebook extension jupyter-threejs/extension...
      - Validating: OK

ball = Mesh(geometry=SphereGeometry(radius=1),
material=LambertMaterial(color='red'),
position=[2, 1, 0])

scene = Scene(children=[ball, AmbientLight(color='#777777')])

c = PerspectiveCamera(position=[0, 5, 5], up=[0, 0, 1],
children=[DirectionalLight(color='white',
position=[3, 5, 1],
intensity=0.5)])
renderer = Renderer(camera=c,
scene=scene,
controls=[OrbitControls(controlling=c)])
display(renderer)
Could not create model:

Model name RendererModel
Model module jupyter-threejs
Model module version 0.3.0-alpha.0
Script error for "jupyter-threejs" http://requirejs.org/docs/errors.html#scripterror




 
 

andrew.m...@gmail.com

unread,
Jun 30, 2017, 2:42:34 AM6/30/17
to Project Jupyter
I am having the same problem.

Simple sphere and text

In [2]:
ball = Mesh(geometry=SphereGeometry(radius=1), 
                                    material=LambertMaterial(color='red'),
                                    position=[2, 1, 0])
scene = Scene(children=[ball, AmbientLight(color='#777777')])
c = PerspectiveCamera(position=[0, 5, 5], up=[0, 0, 1],
                      children=[DirectionalLight(color='white', 
                                                 position=[3, 5, 1], 
                                                 intensity=0.5)])
renderer = Renderer(camera=c, 
                    scene=scene, 
                    controls=[OrbitControls(controlling=c)])
display(renderer)
Could not create model:
Model nameRendererModel
Model modulejupyter-threejs
Model module version*
Script error for "jupyter-threejs" http://requirejs.org/docs/errors.html#scripterror

Jason Grout

unread,
Jul 1, 2017, 10:42:21 AM7/1/17
to Project Jupyter
I'm trying to replicate this. The below works for me. Can you provide instructions for reproducing your error?

conda create --prefix threejstest notebook python ipywidgets pythreejs

source activate ./threejstest

jupyter nbextension enable --py --sys-prefix widgetsnbextension

jupyter nbextension enable --py --sys-prefix pythreejs

source activate ./threejstest

kernelname=`echo $CONDA_DEFAULT_ENV | sed s:/:_:g`

ipython kernel install --name $kernelname --display-name conda-$kernelname --sys-prefix

jupyter notebook


And then I opened the pythreejs example file with the environment kernel and the first example executed just fine.


Looking at the errors you show, it seems that you have widgets installed. It also seems that you have pythreejs installed. I would check to see if the pythreejs extension is enabled:

jupyter nbextension enable --py --sys-prefix pythreejs

And I would also check to see if there are any errors in the javascript console.

Thanks,

Jason


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.

andrew.m...@gmail.com

unread,
Jul 3, 2017, 7:24:54 AM7/3/17
to Project Jupyter, ja...@jasongrout.org
Hi Jason,

Thank you for your response.

I should have mentioned previously that I followed the instruction above to run the following...

jupyter nbextension enable pythreejs --py --sys-prefix

OK...

(C:\ProgramData\Anaconda3) C:\Users\andrew.mole\Source\Repos\JupyterTest01>conda create --prefix threejstest notebook python ipywidgets pythreejs
Fetching package metadata ...............

PackageNotFoundError: Package missing in current win-64 channels:
  - pythreejs

Close matches found; did you mean one of these?

    pythreejs: r-threejs


... so I have now added the conda-forge channel to my config and the installation goes OK... continuing with your instructions and converting to Windows...

conda create --prefix threejstest notebook python ipywidgets pythreejs
source activate ./threejstest
jupyter nbextension enable --py --sys-prefix widgetsnbextension
jupyter nbextension enable --py --sys-prefix pythreejs
activate ./threejstest
kernelname=echo %CONDA_DEFAULT_ENV%   (should be threejstest)
ipython kernel install --name threejstest --display-name conda-threejstest --sys-prefix
jupyter notebook

Yes, it seems to work now! Thank you. For some reason conda doesn't list the new environment (threejstest), but it seems to activate OK. Do you think that the key missing steps were the two "jupyter nbextension enable..."? Do you think adding the conda-forge channel was also important? 

Thanks,
Andrew

andrew.m...@gmail.com

unread,
Jul 7, 2017, 2:02:35 AM7/7/17
to Project Jupyter, ja...@jasongrout.org
Hi Jason,

Thanks for creating this and for all your help. I am making major leaps forward, and can now generate line and face geometry using the PlainGeometry class. I am currently trying to use your 'Indexed Geometries' example and also your 'Buffered' example, but both of them fail. I have managed to get them to display, but I have to make the following changes:
  1. It doesn't like the numpy arrays for vertices and faces, so I changed them to lists of lists.
  2. It doesn't like the colors provided as a numpy array of tuples, then when I changed this into a list of tuples it still complained, then I changed it into a list of lists, but that still didn't work, so I changed it into a list of  explicit colors, such as ['red', 'red', ...], at which point it would run, but it did not show any colors. It now shows a white cube against a black background.
  3. It doesn't like the PlainBufferedGeometry, complaining,   NameError: name 'PlainBufferGeometry' is not defined
Do you have any idea why this is?

Also, I would really appreciate it if you could tell me (or show me) how to add components to a scene (rather than place them all in there at one time). I tried 'scene.add', but it didn't like that.

Thanks,
Andrew

(.\threejstest) C:\Anaconda3>conda list
# packages in environment at C:\Anaconda3\envs\threejstest:
#
bleach                    1.5.0                    py36_0    conda-forge
certifi                   2017.4.17                py36_0    conda-forge
colorama                  0.3.9                    py36_0    conda-forge
decorator                 4.0.11                   py36_0    conda-forge
entrypoints               0.2.3                    py36_1    conda-forge
html5lib                  0.9999999                py36_0    conda-forge
ipykernel                 4.6.1                    py36_0    conda-forge
ipython                   6.1.0                    py36_0    conda-forge
ipython_genutils          0.2.0                    py36_0    conda-forge
ipywidgets                6.0.0                    py36_0    conda-forge
jedi                      0.10.0                   py36_0    conda-forge
jinja2                    2.9.5                    py36_0    conda-forge
jsonschema                2.5.1                    py36_0    conda-forge
jupyter_client            5.1.0                    py36_0    conda-forge
jupyter_core              4.3.0                    py36_0    conda-forge
markupsafe                1.0                      py36_0    conda-forge
mistune                   0.7.4                    py36_0    conda-forge
nbconvert                 5.2.1                    py36_1    conda-forge
nbformat                  4.3.0                    py36_0    conda-forge
notebook                  5.0.0                    py36_0    conda-forge
pandoc                    1.19.2                        0    conda-forge
pandocfilters             1.4.1                    py36_0    conda-forge
pickleshare               0.7.3                    py36_0    conda-forge
pip                       9.0.1                    py36_0    conda-forge
prompt_toolkit            1.0.14                   py36_0    conda-forge
pygments                  2.2.0                    py36_0    conda-forge
python                    3.6.1                         3    conda-forge
python-dateutil           2.6.0                    py36_0    conda-forge
pythreejs                 0.3.0                    py36_0    conda-forge
pyzmq                     16.0.2                   py36_2    conda-forge
setuptools                33.1.1                   py36_0    conda-forge
simplegeneric             0.8.1                    py36_0    conda-forge
six                       1.10.0                   py36_1    conda-forge
testpath                  0.3                      py36_0    conda-forge
tornado                   4.5.1                    py36_0    conda-forge
traitlets                 4.3.2                    py36_0    conda-forge
vs2015_runtime            14.0.25420                    0    conda-forge
wcwidth                   0.1.7                    py36_0    conda-forge
webencodings              0.5                      py36_0    conda-forge
wheel                     0.29.0                   py36_0    conda-forge
widgetsnbextension        2.0.0                    py36_0    conda-forge
wincertstore              0.2                      py36_0    conda-forge




Jason Grout

unread,
Jul 7, 2017, 3:57:33 AM7/7/17
to andrew.m...@gmail.com, Project Jupyter
Your issues seem to stem from using the latest stable release of pythreejs, rather than the latest alpha - the features you talk about are only available in the latest alpha. I will be updating the latest alpha soon as well.

You can add components to a scene by creating a new children array and setting the scene children to the new array.

Thanks,

Jason

andrew.m...@gmail.com

unread,
Jul 7, 2017, 5:08:10 AM7/7/17
to Project Jupyter, andrew.m...@gmail.com, ja...@jasongrout.org
Ah... I thought it might be something like that. Thanks for the quick reply.

Andrew
Reply all
Reply to author
Forward
0 new messages