GitHub Actions fails if used together with IJulia Jupyter kernel
The julia-cache action cannot be used together with the IJulia jupyter kernel. If used together with jupyter, the action fails becaue it cannot find the installed jupyter kernel for julia-1.11.
How to reproduce:
Create a new repo with a Jupyter notebook called main.ipynb containing some Julia code:
import Example
println(Example.hello("world!"))
Then deploy this script using the following GitHub Actions workflow:
on:
workflow_dispatch:
push:
branches: main
name: CI
jobs:
build-deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: write
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Python and then Jupyter
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- run: pip install jupyter
- name: Setup Julia
uses: julia-actions/setup-julia@v2
with:
version: '1.11'
# this doesn't work together with Jupyter.
- name: Cache Julia Packages
uses: julia-actions/cache@v2
- name: Install important Julia packages
shell: bash
run: |
julia -e 'using Pkg; Pkg.add("Example");'
julia -e 'using Pkg; Pkg.add("IJulia");'
- name: Execute main.ipynb with Jupyter
shell: bash
run: jupyter-execute main.ipynb
Expected behaviour: The GitHub Action should run successfully.
Actual behaviour: The GitHub Action fails with the following error message:
ERROR | No such kernel named julia-1.11
Error: Process completed with exit code 1.
NOTE: Since the Github action works correctly without the Julia cache, the problem must be with the Julia cache action.
Here is a sample repo to demonstrate the problem more clearly: Mavoort/julia_cache_action_demo
Does it use a non-standard depot dir? https://github.com/julia-actions/cache/issues/72
I'm not sure what you mean by that. I just installed the IJulia package using Julia's default package manager,
julia -e 'using Pkg; Pkg.add("IJulia");
which is exactly how it's described in the Julia Documentation.
The GitHub action works for other Julia packages (or at least for the example package), so it might be possible that IJulia is installed in an unusual directory. However, I never specified a specific directory, so IJulia is installed in it's default directory.
I'm not saying you've done anything wrong. I'm asking what depot directories IJulia uses/creates, other than the standard ones (packages, compiled, scratchspaces, artifacts etc.)
I'm sorry, but I don't know that. I'm not an expert with Julia packages.
How can I find that out? Do you mean like this?
import IJulia; pathof(IJulia)
Share readdir(Base.DEPOT_PATH[1]) here.
For instance, for me I see this (with comments for the standard julia dirs)
julia> readdir(Base.DEPOT_PATH[1])
17-element Vector{String}:
".DS_Store"
"artifacts" # standard
"clones" # standard
"compiled" # standard
"conda"
"config" # standard
"datadeps"
"dev" # standard
"environments" # standard
"juliaup"
"logs" # standard
"makie"
"packages" # standard
"pluto_notebooks"
"prefs"
"registries" # standard
"scratchspaces" # standard
Okay. I added it to the GitHub actions workflow via
- name: Print Julia Info
shell: bash
run: julia -e 'println(readdir(Base.DEPOT_PATH[1]))'
right before the Jupyter notebook gets executed. It prints:
["artifacts", "compiled", "environments", "logs", "packages", "registries", "scratchspaces"]
Interestingly enough, if I run this without the Julia cache action (where it works correctly), then it prints
["artifacts", "compiled", "conda", "environments", "logs", "packages", "prefs", "registries", "scratchspaces"]
The obvious difference here is the conda entry. Not sure if that's the source of the problem.