Description
I am trying to publish a site via GitHub Actions. I can render successfully on my machine using quarto cli (quarto render .
and quarto publish
, and when I do not include any pages with jupyter: python3
specified in the yaml header, my action works. However, when it hits a page with
---
jupyter: python3
---
in the front matter yaml it fails with:
[10/12] pages/01-reproducible-science-tools/open-reproducible-science/03-best-practices.qmd
Starting python3 kernel...Traceback (most recent call last):
File "/opt/quarto/share/jupyter/jupyter.py", line 21, in <module>
from notebook import notebook_execute, RestartKernel
File "/opt/quarto/share/jupyter/notebook.py", line 17, in <module>
import nbformat
ModuleNotFoundError: No module named 'nbformat'
Python 3 installation:
Version: 3.10.12
Path: /usr/bin/python3
Jupyter: (None)
Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter
There is a environment.yml file in this directory. Is this for a conda env that you need to restore?
I installed and activated my conda environment (which include nbformat, whole environment definition here: https://github.com/cu-esiil-edu/esiil-learning-portal/blob/main/environment.yml) with the following action yaml:
jobs:
build-deploy:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
permissions:
contents: write
steps:
...
- name: Create and Activate Conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: learning-portal
environment-file: environment.yml
auto-activate-base: false
Using shell: bash -el {0}
I have found is necessary to get the conda activation to stick for regular shell commands. And I have checked that the environment is activated and available as a kernel to shell commands with the following:
Run jupyter kernelspec list
Available kernels:
python3 /usr/share/miniconda/envs/learning-portal/share/jupyter/kernels/python3
However, you will notice in the error above that the quarto-actions render action is using /opt/quarto/share/jupyter/jupyter.py
as jupyter, and not the version from my environment.