akgold / do4ds

A book on DevOps for Data Scientists with CRC Press.
https://do4ds.com
Other
130 stars 27 forks source link

Lab 1 - Add a R code chunk for using the virtual python enviornment in model.qmd #252

Open durraniu opened 3 months ago

durraniu commented 3 months ago

The model.qmd file uses python code but does not specify which python env and/or quarto engine is used. By default, quarto uses knitr engine so it tries to use a python env that reticulate finds. This env does not necessarily contain all the required packages and is likely going to be different from the virtual env created by user for this project. My suggestion is to add this R code chunk at the top of model.qmd:

reticulate::use_virtualenv('./.venv', required=TRUE)

assuming that the created virtual env is .venv as recommended in Appendix D.