0

I would like to run python in Rstudio markdown interactively. I use reticulate and could run python in the console but not from the markdown for some reason. It seems like once reticulate::repl_python() is run from the markdown, the chunk is shown running and never stop. I tried running reticulate::repl_python() from the console, but when I try to run the chunks they are all put on hold. Any thoughts on why this is the case? Below is the code I use. Thank you!

library(reticulate)
use_python("/app/python-3.7.2/bin/python3")
py_config()
py_install("pandas")
py_install("scanpy")
reticulate::repl_python()
import numpy as np
import pandas as pd
  • In markdown, you shouldn't need to call `repl_python()`, just tag the chunk ``` {python} ``` and write python code. See [docs](https://rstudio.github.io/reticulate/articles/r_markdown.html) – Parfait Nov 27 '19 at 19:34
  • Thanks for the clarification. I tried that as well using the same code but without repl in {python} but it doesn’t recognize python. – user11602037 Nov 29 '19 at 14:51

0 Answers0