Issues encountered teaching classes with Julia for the first time

I received very bad “teaching scores” last year, and the open-questions in the survey made it clear that the main problem was in having used an odd language nobody knew about… but this made me thinking on the real utility of these kind of surveys… after all, what the students know on what they will need in their (hopefully long) professional carrier ? Yes, they are not CS students, but I honestly thought that showing them how to solve their domain specific problems using a modern programming language and exposing them to it was the best thing I could do for them and their professional future, even if the kind of stuff that I taught could have been done in Excel if one wants.

Indeed this year I did the course in Excel (I made a survey before the course asking them, Excel won) and the students have been happy, sic :-///

8 Likes

You can check with st what versions work for you, and make up a command with all the packages and versions (just an example):

(@v1.6) pkg> add --preserve=all Stipple@v0.6.0 ShiftedArrays@v1.0.0

If the install changed some dependency before, by forcing some versions you know should work, you should get an error with the packages. Or at least I think something like this should work, possibly excluding if you need #main or #master for some package.

ultimately led to the bank to declare $6 billion in losses and could lead to another $600 million in fines. As James Kwak explains on Baseline Scenario, the errors stemmed from a combination of copy-paste mistakes and a faulty equation created to crunch the numbers.

while Excel the program is reasonably robust, the spreadsheets that people create with Excel are incredibly fragile.

3 Likes

Wouldn’t the problem be partly solved by providing an environment with pinned packages? This will not solve all problems but the OP was mainly concerned about what happens if the package landscape is moving during the course. I would argue that the course does not need to follow package changes.

9 Likes

Definitely this. I have one lecture where I have students install some packages, just to see how it works, but everything else uses pre-defined Project.toml and Manifest.toml that students then instantiate.

I make sure students are all installing the same version of julia as me, and I did not encounter any issues, even with windows users. At minimum, you should make sure they’re using projects for everything, then usually it’s easy to reset by just deleting the toml files (though in practice, I’ve never had this issue).

I can’t even imagine what they’re doing that could bork their registry, but it should be as easy as removing the .julia directory, then launching Pkg again.

15 Likes

When I taught a structural dynamics course, I presented the students with tutorials in Julia.
Around one in five students complained about the “unknown” language.
Most came to appreciate it by the end of the course. I’ve had a couple of emails
prasing the choice afterwards. But for some students programming in whatever language will generate
a negative response no matter how hard one tries to make it palatable.

3 Likes

I would not be messing around with add --preserve=all etc.

That will just control what is in the Manifest.toml.
Which means it is a causal ] up away from being swept away.

I really think you have to use Enviroments. they might not solve everything but they will help.
Its also one of the thigns that is way easier in julia than in any of the common alternatives (Python/R/Matlab etc.

At least teach them enough to do julia --project=.
to start julia in an eviroment with a Project.toml that you are providing.
and that has the packages with the compat settings you trust.
Which might be = rather than default ^ compat.
e.g.

[compat]
Stipple="=0.6.0"
ShiftedArrays= "=1.0.0"
11 Likes

One more to @Palli 's list:

There are numerous fundamental issues with Excel like

  • tight coupling of data and logic
  • no version control
  • artificial restrictions like max number of columns / rows

If you are not doing something completely trivial (like adding / plotting a few numbers), Excel is almost always the wrong tool.
Imho every student should learn this lesson.

2 Likes

Is this an undergrad class? Maybe having two required languages is too much anyway. I took biology, not data science so obviously the focus on software use is different. It was coordinated throughout the uni that we would be taught R and only expected to know R for any class. Even then lots of people thought it was terrible that we were being made to use this difficult software “just because it’s free”. Making students learn additional languages for different classes is enough to make most hate coding. Whereas if they are given the space to become competent in one language they may see the power of it and learn to live code.

Honestly, I love Julia. It’s my go to language for any problem. It’s changed my approach to problems and made me a better programmer and scientist. But Ive definitely had more issues getting started with it than I did with R or Python. If students are already learning other languages, I think I’d present examples of things that can be done with Julia but start them out on something more familiar and has more answers on stack exchange etc.

Just my thoughts. I totally get why you want to teach in Julia. And it’s a real shame that there’s been kickback.

7 Likes

Although perhaps I’m being weak/defeatist. You are giving your students a great opportunity. They don’t have to like you for it. But some of them will thank you in the end.

Thanks all for your thoughts. I’ve got a few leads to look into.

One thing I told my students about Julia is that its adoption by industry could very easily pick up dramatically in the next few years. If so, being among the few with it on their CV’s won’t hurt at all.

5 Likes

For three double lectures (of one course) I taught this fall, I made a JupyterHub server in the cloud. Once you know it, it’s reasonably easy to do. I can spin one up now in 15min. See GitHub - mauro3/JupyterHubWithJulia: Desciption & scripts of how to deploy The Littlest JupyterHub with a Julia kernel

One thing to note is that Julia is pretty resource hungry. One notebook will start at around 0.4GB (If I recall correctly). So if you expect that students have several notebooks open at once, you will need to provide enough memory on the machine.

If I taught a whole lecture course, I would probably try to get the students to install Julia on their machine. That way, it’s easier for them to use it in the future (although, probably only few will actually use it again). Maybe having a backup JupyterHub running would be a good idea. That way you can point the students who struggle with the install to there.

5 Likes

I actually have seen my package setup “lock up” two times, I think, but was never able to reproduce it. Maybe if Julia crashes or get’s killed in the middle of certain package management operations?

I’ll like that, too. When some cells are compute-intensive, full automatic update is often not viable. If Pluto had the ability to disable the auto update - either globally, or even better, for selected cells - it would be usage for an even wider range of problems.

Maybe for cells without auto-update (and the cells depending on them) the output could be marked in some way (“greyed out” or so) if it’s out of date, so the user’s won’t overlook it?

2 Likes
3 Likes

I wonder sometimes why people have this attitude that it’s not worth learning a language that is not used by the largest amount of people. R and Python user bases were smaller once as well, and it’s not like the machine learning and statistics software we have now is all perfect. There are so many weird things in R for example, but people mostly ignore or just accept them because they perceive R as the “blessed” choice for statistics, without asking deeper questions why that came about historically. Peculiarities in Julia then might receive much harsher criticism, almost like “why are you trying to displace the status quo with something that is not even perfect yet”

2 Likes

Neptune is essentially Pluto with such a feature (‘don’t execute’) turned on all the time. Have you tried it? My students like it. I set it up, but I don’t claim the credit. Neptune is Pluto, with a pinch of ‘common sense’ (IMO) thrown in.

Think about it from the students’ perspective. One of my semesters in undergrad (around 2010) I was taking 5 STEM courses and doing a research project. Research required me to learn & write Fortran77 and learn how to use Cygwin on my school-issued laptop. Another class required me to learn & use NI for data-acquisition (wind-tunnel) and use Matlab for data analysis. Yet another class had me learning Python for workflow automation (Abaqus scripting). And in yet another class (modeling and analysis of uncertainty) I had to learn & use Minitab. If I all of a sudden found myself in another class, where I could use any of these languages, but my professor mandated I use Julia (or another language) because “it’s the best, trust me” I would have been upset. I had no time to learn yet another language, let alone debug installation issues when I had other perfectly good tools at my disposal.

In my opinion, university shouldn’t be focused on teaching how to use “Language X”, but rather “how to think like a programmer/engineer/scientist.” I think it’s fine to show students a modern language, but at the end of the day all that should matter is whether the student found tools that let them learn and apply their knowledge to solve the assignments. If the student ends up writing a FDM hypersonic CFD code in Excel for their assignment, fine… as long as they produced the results required and implemented the technique properly.

14 Likes

I started with Julia last Fall, and I’ve had issues with 2. and 1. Usually they were caused by me changing from one Python installation or virtual environment to another breaking IJulia, which in turn caused me to re-install the whole :poop:, sorry but that’s how I felt. Now I’ve since learned a lot about how IJulia, Python and Julia are connected, but fixing it when changes happen is not intuitive.

And since I’m on MacOS, installing the software typically works just fine. Homebrew, conda, pip, ven, docker work fine in isolation. Managing Julia and Python installations together is a bit harder but doesn’t break if you don’t move Python. In the same category is the problem that Julia installs its own Python in .julia/conda. Now that I wanted to call Python from Julia I had two Python installations to manage.

I would very much prefer if there was one way to say to Julia that Python is >> here <<. If I change where >> here << is it would do whatever necessary to fix itself like precompiling IJulia. And no secondary internal conda.

Pluto helps a lot because you don’t have Jupyter, so that part can’t break.

I also quite like Docker since I can install any software I want without interfering with my base system. I’d use it more if the memory management was more intelligent. I’ll explain. I’ve run some Julia notebooks that took a lot of more RAM than exists in my Mac, up to 50 GB on a 16 GB mac. MacOS is marvellous, the system didn’t freeze or anything like that. But with Docker I have to set a max memory limit, and then it ends up using that memory all the time.

5 Likes

Actually, this feature basically exists. Making ENV["PYTHON"] point to your python executable and ] build PyCall will tell PyCall to use this global installation rather than installing another one into .julia/conda. Similarily, you can set ENV["JUPYTER"] and ] build IJulia to point to an existing jupyter installation.

8 Likes

I knew the second part. The question then is more of a documentation thing: how to find this information when needed.