Matplotlib dependency for Documenter.jl in Github Actions

I just wrote a small part of the documentation, that uses PyPlots.jl to render a plot (I am actually documenting a PlotRecipe. What is the easiest way to add the matplotlib and python to the documenter Github Action?

I may not be understanding your precise question, but assuming docs/Project.toml exists I think you could just add PyPlot as one of the [deps]. I doubt the workflow script would need changing.

Thanks for the answer. I have PyPlot in my [deps] and all is working fine locally. But on my machine here, I have python and matplotlib installed for sure.

On the CI (GitHubActions, i.e. using a .github/workflows/documenter.yml) this seems to be missing.

PyPlot will install its own python and matplotlib (via Conda.jl) if the environment variable PYTHON is empty (cf. the PyPlot.jl readme). I think doing that would be the easiest way.

Are you sure that works within a CI? The error message I get is

but interestingly, while I had hoped I got at least Gtk to work, that also does not work on CI

I’m not sure that it works, I haven’t tried it myself.

However, I don’t see the environment variable PYTHON being set to "" anywhere in your workflow. The error message says that the python version at /usr/bin/python3 is used, so I would assume that PYTHON is set to /usr/bin/python3.

Thanks for investigating my log and checking. I will try to set it using env in the YAML then.

Independent of whether I try to set

    PYTHON: ""

(See for the error and for how I tried to set it)
in the yaml or

ENV["PYTHON"] = ""

within Julia, the error persists and it’s still looking in the CIs VM in usr/local/bin for a python, see for the commit and for the error).

So where actually do I have to set that environment variable? Or do I have to add python to the action? If so, how?

You have to set the environment variable at the step where the package is built. In your documenter.yml, that is one step later (in julia-actions/julia-docdeploy@v1 instead of julia-actions/setup-julia@latest).

Setting the environment variable in the make.jl file is also not helpful, the package is already built when this is executed.

Adding it to the docdeploy stage seems to have worked, since the images{2,ℝ} are available in the PR. Thanks for the help. I think that way I can now also try to fix the tests and GKS accordingly.