utoronto-2i2c / jupyterhub-deploy

Demo JupyterHub deployment for University of Toronto
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

Install LaTeX? #35

Closed jobovy closed 4 years ago

jobovy commented 4 years ago

I have an exercise for my students that uses some LaTeX rendering in the plot labels and legend and this doesn't seem to work on the jupyterhub (repository here). I can run this successfully on binder by using the following apt.txt file, could you install these dependencies on the jupyterhub (I think these are standard Linux LaTeX packages):

https://github.com/jobovy/sparc-rotation-curves/blob/main/binder/apt.txt

Note that the first entry is the GSL, which isn't necessary for this (and is probably already installed?).

Thanks!

choldgraf commented 4 years ago

Looking through here: https://github.com/utoronto-2i2c/jupyterhub-deploy/blob/staging/deployments/utoronto/image/Dockerfile I don't see any Latex, so I think that'd be where it needs to be installed.

It's definitely possible - might take a little bit of fiddling since latex has a tendency to be a beast to install and configure :-)

Do you have any kind of time-table for needing this?

jobovy commented 4 years ago

Thanks for looking into this! The assignment that this is relevant for is due in just a few days and I've given the students a work-around, so it's not terribly urgent at this point.

I install latex a lot in binders and GitHub workflows using the apt.txt file that I linked to above and that seems to work pretty well, so may not be that hard?

yuvipanda commented 4 years ago

Apologies for missing this, @jobovy. I just tried it on the toronto hub, and got a working PDF: sparc-rotation-curves(1).pdf

We also do have LaTeX installed (https://github.com/utoronto-2i2c/jupyterhub-deploy/blob/staging/deployments/utoronto/image/Dockerfile#L73), although only a couple of the base packages. I'll add more of the tex packages listed in your apt.txt as well. But let me know if it already works?

jobovy commented 4 years ago

Hi @yuvipanda, thanks for looking into this! I think the issue is related to matplotlib's typesetting of LaTeX, which still doesn't work on the server (the issue isn't just compiling the notebook to PDF, but just running the notebook; note that to actually run the notebook you have to install additional code). I think it needs all of the packages in the apt.txt that I mentioned to work.

Although this problem would probably come up in future activities/assignments for my course, the assignment that sparked this issue has now been handed in and all the students managed to find a work-around. So this isn't urgent to fix right now, at least for us.

choldgraf commented 4 years ago

@jobovy out of curiousity, would it have been equally useful to allow for a non-latex PDF conversion via HTML? That is often more reliable than getting all the right Latex edge-cases to work for typesetting, and the output looks much closer to what the student notebooks look like when they're writing the content.

jobovy commented 4 years ago

@choldgraf -- I'm not sure what you mean. The issue is just that I use LaTeX to typeset axis labels and legends in the matplotlib figures generated in the notebook. The issue isn't related to converting the notebook to PDF (it's not related to PDF output at all!). I think the latter is what you are getting at?

yuvipanda commented 4 years ago

@jobovy ah, am sorry you had to implement workarounds! I've installed the packages mentioned here (I think), do you think you would have time to test it out? Would be very useful for me, since I'm not very well versed in TeX.

jobovy commented 4 years ago

@yuvipanda -- Still doesn't work, I think it specifically needs the cm-super apt package (a LaTeX package with some special fonts).

choldgraf commented 4 years ago

@jobovy ah gotcha - I mis-read the issue here, sorry for the noise!

yuvipanda commented 4 years ago

@jobovy cm-super is installed now! I'm also not sure what to look for to test, so if you could test again when you can that would be great!

jobovy commented 4 years ago

@yuvipanda -- thanks! That got us further, but now matplotlib is complaining that it doesn't have dvipng... So it looks like the dvipng entry in the apt.txt file that I linked to above needs to be installed too, perhaps ghostscript as well.

yuvipanda commented 4 years ago

Ok, so I installed dvipng and ghostscript as well, and with apt list --installed verified that everything in the apt.txt (except libgsl) is installed there (I've also automated this during deploy with https://github.com/yuvipanda/hubploy/pull/107). libgsl is coming from conda, and I verified it is installed with conda list | grep gsl.

Hopefully, I'll be able to work on making these list of installed packages public in an easy way so there can be a reference for what new ones actually need to be installed...

Thank you for your patience!

jobovy commented 4 years ago

@yuvipanda -- Thanks, it works now 🎉 🎉 !

I also saw that 2i2c got funding, congratulations! I think this will really revolutionize incorporating interactive computing in teaching!

yuvipanda commented 4 years ago

:D Thank you for your patience, @jobovy!