[x3d-public] jupyter notebook

John Carlson yottzumm at gmail.com
Tue May 21 11:05:22 PDT 2019


Yeah, that jar in the X3DJSAIL repo is ancient, and not kept up-to-date.

The one here is 2 months old:

https://github.com/coderextreme/pythonSAI

You can build your own X3DJSAIL with this repository, if you like something simple:

https://github.com/coderextreme/JavaSceneAuthoringInterfaceLibrary

But it’s not a “fat” jar.  For that, you need Don’s build of the full jar below, or from Don’s X3DJSAIL web page.

Otherwise, you have to use the ant target create.X3DJSAIL in www.web3d.org/x3d/stylesheets/ (sourceforge download). Jars are found in java/jars below that.

I’ve been seduced by the dark-side, Don and X3DJSAIL, and have not been maintaining my projects.  X3DPSAIL is a happy medium, and now thanks to you, a nearly publishable medium.

Are you by chance, working on a Anaconda package so we can import x3dpsail (the first script on your page) into jupyter?  I have a way to generate python application scripts (second script on page) with leading x3dpsail. in front of the constructor calls.   This is to reduce namespace pollution.  Do we just need to install https://github.com/andreasplesch/conda?  Could you provide instructions on how to install  into our own docker or jupyter enviroments?  Looks like https://mybinder.org/ leads the way. Or do you want to support everyone’s development with your docker?  …could get kind of crowded.  I think the best solution is to create a conda package for x3dpysail which includes the python and the jar.  I saw one issue on it, but it was VERY long, and closed, so I assume there’s documentation on how to include a jar in a conda package somewhere, just not sure where yet.

John

Sent from Mail for Windows 10

From: Andreas Plesch
Sent: Tuesday, May 21, 2019 11:10 AM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: [x3d-public] jupyter notebook

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190521/ce78a980/attachment-0001.html>


More information about the x3d-public mailing list