liesel-devs / liesel

A probabilistic programming framework
https://liesel-project.org
MIT License
38 stars 2 forks source link

Rendering pymc tutorials in the docs CI is failing #159

Closed jobrachem closed 8 months ago

jobrachem commented 8 months ago

Link: https://github.com/liesel-devs/liesel/actions/runs/6893579115/job/18753461961

This is the error message:

[2/8] 06-pymc.qmd

processing file: 06-pymc.qmd

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |....                                                                  |   5%
  ordinary text without R code

  |                                                                            
  |.......                                                               |  11%
label: setup (with options) 
List of 2
 $ engine : chr "python"
 $ include: logi FALSE

Quitting from lines 6-17 (06-pymc.qmd) 
Error in py_call_impl(callable, call_args$unnamed, call_args$named) : 
  TypeError: decode() argument 'encoding' must be str, not None
Run `reticulate::py_last_error()` for details.
Calls: .main ... py_capture_output -> force -> <Anonymous> -> py_call_impl

Execution halted
ERROR: Error
    at renderFiles (file:///opt/quarto/bin/quarto.js:86658:30)
    at async renderProject (file:///opt/quarto/bin/quarto.js:86800:25)
    at async Command.fn (file:///opt/quarto/bin/quarto.js:90856:32)
    at async Command.execute (file:///opt/quarto/bin/quarto.js:8437:13)
    at async quarto (file:///opt/quarto/bin/quarto.js:127545:5)
    at async file:///opt/quarto/bin/quarto.js:127563:9
Error: Process completed with exit code 1.

We do not use decode() in the liesel source code anywhere as far as I can tell. My current assumption is that this is caused by a dependency.

wiep commented 8 months ago

Maybe an error related to quarto? In the sense that quarto need to read and write input to python.

jobrachem commented 8 months ago

Then it would surprise me a little that we see it only in one tutorial. I ran it locally to gather more information.

The error occurs in the setup code chuck. If I comment out both the pymc import and the PyMCInterface import, then quarto does get past the setup code block. Of course the liesel pymc module imports pymc. So my guess is that the error is caused in some way by pmc. But actually you are right: The error only occurs when rendering with quarto, not when I run the code block individually. So it seems to be the combination of quarto and pymc that causes the problem.

#| label: setup
#| include: false

import liesel.goose as gs
# import pymc as pm
import numpy as np

# from liesel.experimental.pymc import PyMCInterface
import jax

gs.Summary._repr_markdown_ = gs.Summary._repr_html_
jobrachem commented 8 months ago

I pinned the pymc version and submitted an issue to quarto: https://github.com/quarto-dev/quarto-cli/issues/7684 I also created a new issue to remind us to unpin pymc once the issue is resolved: #162

jobrachem commented 8 months ago

Seems to be a reticulate problem. There's now also an issue on the reticulate repo: https://github.com/rstudio/reticulate/issues/1508