Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knit error when using reticulate in Rmarkdown #863

Open
Alalalalaki opened this issue Oct 6, 2020 · 5 comments
Open

Knit error when using reticulate in Rmarkdown #863

Alalalalaki opened this issue Oct 6, 2020 · 5 comments

Comments

@Alalalalaki
Copy link

Alalalalaki commented Oct 6, 2020

Hi

This is related to #831 . I face up to exactly the same error and by using development version of reticulate, I can now successfully run python chunks directly in Rmarkdown. However, when I knit the Rmarkdown, it stops at $ engine: chr "python" and never finish running or report any errors.

Thanks.

@kevinushey
Copy link
Collaborator

Without a reproducible example, there is nothing I can do.

@Alalalalaki
Copy link
Author

Alalalalaki commented Oct 6, 2020

@kevinushey Sorry, I thought this is trivial.

image

image

@mabesa
Copy link

mabesa commented Dec 12, 2020

Hi, I encounter the same behaviour. Already spent hours trying to get my doc knit to html and would really appreciate a hint for a search direction.

This is my markdown example which works as expected when "Run All" but stalls at $ engine: chr "python" (- before ``` added to be able to display the markdown file). Also tried to ask on stack exchange but wasn't able to solve the problem so far.

---
title: "test knitr python"
output: html_document
---

-```{r setup, include=FALSE}
library(reticulate)
use_python('~/anaconda3/envs/gwpy37/bin/python3')
knitr::opts_chunk$set(echo = TRUE)
-```

-```{r}
version$version.string
rstudioapi::versionInfo()$version
packageVersion('reticulate')
-```

[1] "R version 4.0.2 (2020-06-22)"
[1] ‘1.3.959’
[1] ‘1.18.9000’

-```{python}
import sys
sys.version

a = 1
-```

'3.7.9 (default, Aug 31 2020, 07:24:53) \n[Clang 10.0.0 ]'

-```{r}
py$a
-```

[1] 1

@mabesa
Copy link

mabesa commented Dec 12, 2020

Was able to knit the minimal example above by specifying knitr::opts_chunk$set(engine.path = list(python = '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3')) in the setup chunk. Could this be an issue with anaconda? I cannot knit when I try to use the python 3.8 version in anaconda in ~/anaconda3/envs/gwpy38/bin/python in the opts_chunk command.

@JohnGranger
Copy link

You can render Rmd file in console, like this:

> rmarkdown::render("test.Rmd")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants