Open eculler opened 8 months ago
Thanks a lot for the report. I believe we need some adjustment for Conda environment, as we have done for virtualenv to make sure the activated env works.
As a workaround, I am thinking that if you set QUARTO_PYTHON
environment variable in CI jobs to the python version from your learning-portal
, Quarto CLI should not do any Python auto-detection and use the right version...
Unless this is an issue only for kernel detection where first occurrence of python3
kernel found is used. 🤔
Anyhow, I am thinking we should detect CONDA_DEFAULT_ENV
and if this is set, use that. Can you confirm this env var is set only when you activate a conda environment ?
Thanks!
Thanks @cderv . I've been using the QUARTO_PYTHON variable, and that works both for my GitHub Actions and also for previewing on my machine.
The following is my output for the CONDA_DEFAULT_ENV variable under different circumstances -- it appears to correspond with the active environment:
(earth-analytics-python) elsa@ESC-Macbook esiil-learning-portal % echo $CONDA_DEFAULT_ENV
earth-analytics-python
(earth-analytics-python) elsa@ESC-Macbook esiil-learning-portal % conda deactivate
(base) elsa@ESC-Macbook esiil-learning-portal % echo $CONDA_DEFAULT_ENV
base
(base) elsa@ESC-Macbook esiil-learning-portal % conda deactivate
elsa@ESC-Macbook esiil-learning-portal % echo $CONDA_DEFAULT_ENV
elsa@ESC-Macbook esiil-learning-portal %
I am trying to publish a site via GitHub Actions. I can render successfully on my machine using quarto cli (
quarto render .
andquarto publish
, and when I do not include any pages withjupyter: python3
specified in the yaml header, my action works. However, when it hits a page within the front matter yaml it fails with:
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:
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: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.