[x3d-public] jupyter notebook

Andreas Plesch andreasplesch at gmail.com
Tue May 21 10:05:35 PDT 2019


Hi John,

github issues record that there was a change for jupyter-lab to
sanitize js scripts in HTML for security. Now it works to switch from
non-trusted to trusted in the gui and then execute the cells. This
disables the sanitizing.

There is the red sphere:

https://mybinder.org/v2/gh/andreasplesch/conda/master?filepath=sphere.ipynb

Looks all good.

Of course, now, in addition to constructing a scene, one would like
dynamically update or modify the scene.

-Andreas

On Tue, May 21, 2019 at 12:10 PM Andreas Plesch <andreasplesch at gmail.com> wrote:
>
> Hi John,
>
> thanks for the quick response. I had provided an older X3DJSAIL.jar
> from https://github.com/coderextreme/X3DJSAIL which had the advantage
> of being small.
>
> Now, that I found the more up to date
> http://www.web3d.org/specifications/java/jars/X3DJSAIL.3.3.full.jar
> and use that instead, things start to work (!). [Most links to the jar
> on the page need to be updated].
>
> Try again, the same link:
> https://mybinder.org/v2/gh/andreasplesch/conda/master?filepath=sphere.ipynb
>
> The errors are gone when you execute the cells.
>
> The generated xml looks good.
>
> But the IPython.display HTML function does not display anything. Does
> that work locally for you ? HTML(data='<h1>Title</h1>') works. Maybe
> an iframe is necessary.
>
> -Andreas
>
>
>
> On Tue, May 21, 2019 at 11:20 AM John Carlson <yottzumm at gmail.com> wrote:
> >
> > Hi Andreas.
> >
> >
> >
> > Summary:  I don’t think the X3DJSAIL .jar was found in .
> >
> >
> >
> > I tried a very similar script to yours, putting the jar in the home folder.  I suspect that you don’t have access to your home folder, or the jar was uploaded as unreadable. Once I put my X3DJSAIL.3.3.full.jar in my local environment home, the classpath started working.
> >
> >
> >
> > I tried without the jar in place, and got similar issues with PointProperties.
> >
> >
> >
> > I tried running your remote jupyter and got similar results.
> >
> >
> >
> > I suspect readability issues or something configured with your classpath/jar.
> >
> >
> >
> > We need to get the jar into the x3dpsail conda package, I think.  An unsolved problem.
> >
> >
> >
> > It should run okay with a local anaconda.  I realize you want to run remote.  We understand, and will attempt to deliver a conda package in the next month or so.
> >
> >
> >
> > If you would like to help, we’re working on creating an x3dpsail package which includes all dependencies.  We have the start of a pip package, but so far, it won’t upload.   A Jupyter conda package is probably more acceptable to most people.
> >
> >
> >
> > It might be instructive to issue the first script with a single Java class, to see if it can find one Java class.  That will direct you to the smoking gun.  If it can’t load one class, then the classpath isn’t working.
> >
> >
> >
> > If you set a CLASSPATH environmental variable (java’s classpath) in your docker image, it might work better, give it a try. I am staying away from docker for now.   Ensure that OpenJDK or similar is deployed with jnius.
> >
> >
> >
> > Conclusion:
> >
> >
> >
> > X3dpsail has been shown to work with an absolute path or the jar on a local system.  Try to use an absolute path in conda in the short term (within your sandbox), until we get a conda package for x3dpsail.
> >
> >
> >
> > John
> >
> >
> >
> > Sent from Mail for Windows 10
> >
> >
> >
> > From: Andreas Plesch
> > Sent: Tuesday, May 21, 2019 9:22 AM
> > To: X3D Graphics public mailing list
> > Subject: [x3d-public] jupyter notebook
> >
> >
> >
> > Hi John,
> >
> >
> >
> > I was curious and gave Pyjnius+X3DJSAIL.3.3 from your repo a try with
> >
> > your sphere.ipynb, using online jupyter with mybinder.org:
> >
> >
> >
> > https://github.com/andreasplesch/conda
> >
> >
> >
> > Use this link
> >
> >
> >
> > https://mybinder.org/v2/gh/andreasplesch/conda/master?filepath=sphere.ipynb
> >
> >
> >
> > and wait until the server starts with the mybinder built docker image
> >
> > (takes a bit).
> >
> >
> >
> > Executing then the first cell with all the autoclass generation does
> >
> > something until there is an error:
> >
> >
> >
> > JavaException                             Traceback (most recent call last)
> >
> > <ipython-input-1-149e86182885> in <module>
> >
> >      87 HAnimHumanoid =
> >
> > autoclass('org.web3d.x3d.jsail.HAnim.HAnimHumanoidObject')
> >
> >      88 HAnimJoint = autoclass('org.web3d.x3d.jsail.HAnim.HAnimJointObject')
> >
> > ---> 89 HAnimMotion = autoclass('org.web3d.x3d.jsail.HAnim.HAnimMotionObject')
> >
> >      90 HAnimSegment = autoclass('org.web3d.x3d.jsail.HAnim.HAnimSegmentObject')
> >
> >      91 HAnimSite = autoclass('org.web3d.x3d.jsail.HAnim.HAnimSiteObject')
> >
> >
> >
> > /srv/conda/envs/notebook/lib/python3.7/site-packages/jnius/reflect.py
> >
> > in autoclass(clsname)
> >
> >     157
> >
> >     158     # c = Class.forName(clsname)
> >
> > --> 159     c = find_javaclass(clsname)
> >
> >     160     if c is None:
> >
> >     161         raise Exception('Java class {0} not found'.format(c))
> >
> >
> >
> > jnius/jnius_export_func.pxi in jnius.find_javaclass()
> >
> >
> >
> > JavaException: Class not found b'org/web3d/x3d/jsail/HAnim/HAnimMotionObject'
> >
> >
> >
> > The good news is that the online jupyter notebook seems to work in
> >
> > principle, eg. Pyjnius and java is installed, and the X3DJSAIL.3.3.jar
> >
> > seems to be found as well.
> >
> >
> >
> > Have you seen problems with the HAnimMotion before ?
> >
> >
> >
> > Commenting out HAnimMotion, uncovers similar errors for PointProperties and X3D.
> >
> >
> >
> > JavaException                             Traceback (most recent call last)
> >
> > <ipython-input-1-f7be65079716> in <module>
> >
> >     255 Scene = autoclass('org.web3d.x3d.jsail.Core.SceneObject')
> >
> >     256 unit = autoclass('org.web3d.x3d.jsail.Core.unitObject')
> >
> > --> 257 X3D = autoclass('org.web3d.x3d.jsail.Core.X3DObject')
> >
> >     258 SFBool = autoclass('org.web3d.x3d.jsail.fields.SFBoolObject')
> >
> >     259 MFBool = autoclass('org.web3d.x3d.jsail.fields.MFBoolObject')
> >
> >
> >
> > /srv/conda/envs/notebook/lib/python3.7/site-packages/jnius/reflect.py
> >
> > in autoclass(clsname)
> >
> >     157
> >
> >     158     # c = Class.forName(clsname)
> >
> > --> 159     c = find_javaclass(clsname)
> >
> >     160     if c is None:
> >
> >     161         raise Exception('Java class {0} not found'.format(c))
> >
> >
> >
> > jnius/jnius_export_func.pxi in jnius.find_javaclass()
> >
> >
> >
> > JavaException: Class not found b'org/web3d/x3d/jsail/Core/X3DObject'
> >
> >
> >
> > Is there another Pyjnius or X3DJSAIL.jar to try ?
> >
> >
> >
> > Pyjnius is installed with conda and a pyjnius line in environment.yml.
> >
> >
> >
> > -Andreas
> >
> >
> >
> >
> >
> > --
> >
> > Andreas Plesch
> >
> > Waltham, MA 02453
> >
> >
> >
> > _______________________________________________
> >
> > x3d-public mailing list
> >
> > x3d-public at web3d.org
> >
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >
> >
>
>
>
> --
> Andreas Plesch
> Waltham, MA 02453



-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list