Knit doesn't end when executing python block

Knit process gets stuck and doesn't terminate when it executes python block.
Last message from console:
List of 1
$ engine: chr "python".

To recreate execute:

{r setup, include=FALSE}
library("reticulate")
knitr::knit_engines$set(python = reticulate::eng_python)
#use_python("C:/Users/jj/AppData/Local/Continuum/anaconda3", required=TRUE)

{python}
lst=[3,5,2]
print(max(lst))

{r}

This is working fine on my side. You may need to check your python setup.
Does reticulate already works in a R script and not a Rmd ?

I got the issue fixed!
Sorry, but I think you didn't understand my problem.

library("reticulate")
knitr::opts_chunk$set(python.reticulate=FALSE)

Including this in the rmd files helps resolves the issue. Knit to pdf can be used after using the above command.

1 Like

Glad it works !

With this option to FALSE, you just deactivated the reticulate python engine for knit. That means your python chunks are not using reticulate anymore, but knitr is using directly python executable. This is fine is your case, but reticulate should work in Rmd doc, and is required to have some specific feature of integration between R and python in Rmd notebook.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.