Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support 3d graphics in sage mode in Jupyter notebooks #159

Closed
williamstein opened this issue Oct 10, 2015 · 14 comments
Closed

support 3d graphics in sage mode in Jupyter notebooks #159

williamstein opened this issue Oct 10, 2015 · 14 comments

Comments

@williamstein
Copy link
Contributor

williamstein commented Oct 10, 2015

Replicate:

  • Open ipython notebook
  • Choose current SageMath kernel
  • In a codecell enter the code
x, y = var('x y')
S = sphere((0,0,0),size=0.3, color='red', aspect_ratio=[1,1,1])
show(S, figsize=8)
  • No plot appears...

Correct url for jsmol.min.js is broken.

@williamstein
Copy link
Contributor Author

This url at least has that file: http://chemapps.stolaf.edu/jmol/jsmol/

@williamstein
Copy link
Contributor Author

@williamstein
Copy link
Contributor Author

Bug since it silently fails.

@williamstein
Copy link
Contributor Author

This is exactly this problem: jupyterhub/jupyterhub#401

It's I guess a bug in Sage. It's still a problem in sage-7.4

@williamstein
Copy link
Contributor Author

williamstein commented Oct 27, 2016

If we make it so https://cloud.sagemath.com/nbextensions/jsmol/JSmol.min.js serves the file JSmol.min.js, then this may work fine for us. This JSmol.min.js is I think not updated much (maybe not once in 3 years). It's 223K and is in /projects/sage/sage-7.4/local/share/jsmol/JSmol.min.js.

FALSE: actually many more files are needed (maybe 20MB+ more)...

@williamstein
Copy link
Contributor Author

No, that's just too ugly -- we really need to do this right by fixing sage. Also, our static content really should get served via /static.

@williamstein
Copy link
Contributor Author

OK, giving up on this for now.

@williamstein
Copy link
Contributor Author

I reported it upstream to the sage-devel list.

@williamstein
Copy link
Contributor Author

Potentially very useful discussion: https://groups.google.com/forum/#!topic/sage-devel/VR6YEwCTsE4

@williamstein
Copy link
Contributor Author

Maybe fixing this would just involve serving the relevant jmol 3d files from the right url via nginx. If you try to draw a 3d plot in jupyter sagemath mode, and watch the terminal, you'll see what absolute path from sage it fails to pull in. It's trying to download several megabytes of javascript/html/etc. -- some sort of automatic generated js (from java). It fails because Volker doesn't understand jupyter base url stuff. But we could actually fix it to work by just making that path be available (bundling it up as part of making the production site), and that would also be much faster (getting the html/js from our cdn rather than via an http tunnel).

@haraldschilly haraldschilly self-assigned this Nov 22, 2016
@amirsagiv
Copy link

Hello, I just wanted to say that we've tested it on development version 7.5.beta3 (0c6824fff559e93b5517e53cd90ac1f1b04accf9) (git://github.com/sagemath/sage.git), and it seems to work. The test was performed on Debian testing xenial. All the examples were displayed correctly with Jupyter.
Thanks!

@williamstein
Copy link
Contributor Author

@amirsagiv -- thanks. The problem is that Sage's 3d graphics are supported via some very hacky techniques, and do not properly support Jupyter's base_url functionality. This means they can't work in SMC, without some significant changes.

(For anybody reading this, 3d graphics do work well in Sage worksheets in SMC.)

@haraldschilly
Copy link
Contributor

I've deployed a workaround, closing it.

@amirsagiv
Copy link

amirsagiv commented Nov 25, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants