Issues encountered teaching classes with Julia for the first time

This semester, for the first time, I have assigned Julia as a required language in my Data Science classes, alongside R. While I am not a beginner to Julia, I am posting this here because I am a novice at trying to use it in teaching.

By and large, there is some good work getting done, but I am facing a huge problem in student forums. To students (especially the less technical ones), Julia seems ‘buggy’ and I seem to be the target of resentment for my having chosen it.

Students initially found Julia a bit different and difficult, but came to appreciate it, I think. That, at least, is the hopeful part.

The issues, it seems arise from their claims that Julia seems buggy - that basic packages which load and work fine for them sometimes then break for no obvious reason, just when they have an assignment due, [and other issues like this]. Let me list the most common issues, and request suggestions on how to I might go about addressing them.

  1. Package Manager problems, leading to fixes like having to manually delete ‘Registry.toml’. Packages (e.g. Flux) spontaneously break irretrievably.
    Once things start going wrong here, there seems to be no obvious ‘reset’ button.
    [even Environments often don’t help, and I don’t even want them to have to go that far]
    20% of the class have had these sorts of issues

  2. Jupyter /IJulia Students have found it to be unstable (kernel keeps quitting, etc.) and also resource-hungry (maybe causes the former if they are using old hardware).
    Also, IJulia breaks and/or the relationship between Jupyter and Julia through IJulia can break down or not be established unless students know how to manually assign paths.
    [I anticipated these issues, which is why I introduced Neptune, which is not perfect, but seems to address most of the above issues]

  3. LibGR plotting issues. Mostly these don’t happen, but when they do, they are fatal to plotting and seem near impossible to solve - there seems to be no easy ‘reset’ button. Seems to have happened to about 10% of the class.

  4. Data repository retrieval (e.g. ISLR) spontenously stops working [I teach a Data Science class using data from ISLR]. [Workaround: Get the data in R, and manually save it and load it into Julia]

I love the capabilities that Julia enables for a juicy Data Science class or similar, and I would like to be able to continue using it. At the same time, I would like to be able to teach a class without fear of being chased up a hill by a crowd of students with torches.

I wonder if anyone has any suggestions for me?

39 Likes

That definitely sounds frustrating.

The problem here is that most of these issues are not specific or detailed enough to be actionable. For example, I personally have never had to delete Registry.toml, and I’ve never had a package break spontaneously or irretrievably, so it’s difficult to even imagine what is going on in that case. That makes it nearly impossible to take any action on these issues, since there isn’t enough information to reproduce or diagnose the underlying cause.

Given that, my suggestion would be to create specific bug reports (github issues, discourse posts, or whatever you want), as soon as these issues happen, with as much detail as you can provide. This can be difficult to do when it stands in the way of someone getting their work done, but it’s really the only way to make progress. It also might help us figure out why your students seem to be having package issues at a higher rate than I have experienced.

18 Likes

Thank you for your thoughts. I am hoping that perhaps others who may have taught classes with Julia might have some thoughts on how to manage some of these issues en masse. One thing that occurs to me that for nearly all students, everything seems to work initially, but things go wrong later. Reinstalling is time-consuming and doesn’t always fix the problem. What I think could work if there were a ‘reset’ option which would delete all the installed packages and completely reset the Package Registry to the state it would have been after a fresh install. I know the Environments are supposed to help with this, but even that doesn’t always work, nor do I want my students to have to go there in any case.

Would this (a complete ‘reset’ option) be even possible?

Thanks again!

1 Like

If you are teaching using Windows please, please consider advising your students to use the chocolatey package manager to install and update Julia.

Also the Pluto.jl notebooks are fantastic - they are being used in the MIT Computational Thinking course this weekend.
Would you be willing to at least take a look at Pluto?
I have not see

2 Likes

I’d suggest using a portable Julia with its own depot. That is your reset button.

4 Likes

Yes, I like Pluto, but couldn’t cope with the ‘reactive’ aspect for my Data Science projects. I asked the Pluto devs to consider allowing ‘static’ as an option, but they were very much against this, so I forked a ‘static’ version, called it ‘Neptune’ and (with homage to Pluto) made it available. My students like it. Maybe the Pluto devs. will eventually add a ‘static’ option as well (or already have?).

3 Likes

Hi. Thanks. That sounds promising.

Do you have a link for learning about that?

I’m not sure what the problem is in each case, but a possible solution might be to pin down all versions somehow:

I tend to install a LOT of packages to experiment (like a curious student might do), and maybe that’s my problem (doing something wrong? should use environments?), and if it downgrades (or even upgrades) packages, it can be a problem.

You might want to be aware of the preserve option (that apparently there didn’t work…):

(@v1.6) pkg> add --preserve=all Stipple
   Updating registry at `~/.julia/registries/General`
######################################################################## 100,0%
  Resolving package versions...
  Installed p7zip_jll ─ v16.2.1+1
Downloading artifact: p7zip
No Changes to `~/.julia/environments/v1.6/Project.toml`
Updating `~/.julia/environments/v1.6/Manifest.toml`
  [3f19e933] ↑ p7zip_jll v16.2.1+0 ⇒ v16.2.1+1

Without it (and I often forget) I tend to get upgrades, but also downgrades… often to VERY old versions. Sometimes, such as for Stipple, you need some old version (for demos), and sometimes you need the latest or master. It’s usually not a problem (I think!) except for such WIP packages.

Possibly the GR issue you is the defunct problem I had, see here:

3 Likes

Hi Thanks for that. I think these students are mostly on Windows, and the issues they are having I have not recently experienced myself on Mac or LInux. Where can I learn about ‘chocolatey’?
Thanks!

1 Like

This is what I use:

2 Likes

Chocolatey is a package manager for Windows, similar to apt or yum from the Linux world or Brew from Mac

I think the simplest way would be to have a JupiterHub server where you set up the necessary packages for the students (I use a medium-power server where I load the necessary packages in a script that is executed when I add the user with adduser… with 20 students is ok…).

My biggest problem, by teaching applied problems where Julia is used to run computational example/applications to students on their last year, is that in the previous years the students already had courses in R and Python or in subjects where the teacher was using them, and their approach is “aargh, yet an other programming language to learn, can we not use what we already know ?” :-/

16 Likes

Yes, the same here, and I was just starting to win them over when alot of students started having the issues I described above, and the combination of these two things has made life very difficult for me (you wouldn’t want to be me at the moment!)

3 Likes

A basic issue here is that ensuring smooth software installation for a large class, on a large variety of systems (that might be old or weird in various “creative” ways) is hard. Especially when you are combining lots of different software packages together (e.g. IJulia requires Julia and a working and compatible Python+Jupyter installation with lots of ancillary software). Software-engineering courses combat this by having a small army of computer-savvy TAs (which is not typically available in a non-CS class), plus if you are using something familiar like Python then the students have many peers who are experts and can help.

The best solution in the long run at universities is to have a local jupyterhub/binderhub server or similar, so you can just point students at a URL and then they run everything in the cloud in a “clean” software environment that is the same for everyone.

When I’ve taught large (150–200) classes in the past with Julia, I used juliabox.com, but that is no longer a free service. Currently, I’m encouraging them to install locally if they can, but use mybinder.org as a fallback: GitHub - mitmath/julia-mit: Tutorials and information on the Julia language for MIT numerical-computation courses.

24 Likes

You mentioned Jupyter/IJulia I don’t have any experience with those but your comment about resetting the environment make me think about docker. Granted this is another software package that you could end up having issues with :slight_smile: but it does make it really easy to restart the environment.

https://hub.docker.com/_/julia

$ docker run -it --rm julia

Or running a script on your machine:

$ docker run -it --rm -v "$PWD":/usr/myapp -w /usr/myapp julia julia script.jl arg1 arg2

These would work on a Linux host arguments might be different on a Windows host. The --rm tells docker to destroy the machine after you exit, which means you get a clean environment every time.

You could not pass the --rm and name the docker container so you can save the environment if the pre-compilation is too much, there would be additional commands to destroy/recreate the container if you wanted to clean out the environment. It’s an option you might want to investigate.

1 Like

Adding to what Jordan said, the first thing to do after installing chocolatey is to install the GUI:

choco install chocolateygui

I assume most of his users are Windows users and Docker on Windows is…painful to say the least. Virtually everyone who uses Docker on Windows does so with WSL which is then yet another can of worms to open up. (And at that point you can install Julia in the WSL subsystem to avoid some of the Windows issues anyways).

2 Likes

For remote use of Julia for a lab class, we offer a binder image. As our package usages are not open-ended, we can make a fairly tidy image which loads quickly. (E.g., we use SimplePlots, not Plots because it loads faster, though that will change once 1.6 is supported.) Binder has the issue of limited resources and a timeout with 10 minutes of inactivity. However, encouraging students to get an account on notebooks.gesis.org allows these limits to be bumped up quite a bit for little extra effort.

We have also provided a Docker image, which I personally use so that my setup matches the students. I don’t know that any students have used it, though it works quite easily on my Mac.

Some students will install everything locally, but in practice, that is often a bit more bumpy than it should be.

1 Like

Can you give some more detail about this? How do you instruct students to install Julia and the packages they need? And what do you ask them to do? And what kinds of things go wrong?

4 Likes

Hi. Thanks, That sounds promsing. I’ll try it out.