Questions tagged [reticulate]

Usage questions regarding reticulate R package which provides a comprehensive set of tools for interoperability between Python and R.

Questions on the reticulate R package which provides a comprehensive set of tools for interopability between Python and R. More information on tutorials and API reference can be found on reticulate's website.

486 questions
8
votes
1 answer

Attaching python script while building r package

I have not found some R package ( there is no one, trust me) for my tasks, but there is one in python. So i wrote python script and used reticulaye::py_run_file('my_script.py') in some functions. But after building and installation, package can't…
8
votes
3 answers

Specify reticulate python path in RETICULATE_PYTHON environment variable

Whenever I use reticulate in RStudio, the default REPL is using python2.7, but I want to use python3 per default. I have added the python path to python3 to my .bashrc in the environment variable RETICULATE_PYTHON and when I use R and reticulate…
clemens
  • 6,653
  • 2
  • 19
  • 31
8
votes
2 answers

Error: Unable to find conda binary. Is Anaconda installed? reticulate Rstudio

I installed reticulate via Rstudio. Now i want to use conda_create() but I installed anaconda in another directory then the default. How can I change the directory in which Rstudio is searching for anaconda? Error: Unable to find conda binary. Is…
Henryk Borzymowski
  • 988
  • 1
  • 10
  • 22
7
votes
1 answer

How to call Python function from R reticulate in Rmarkdown

I have this Rmarkdown, with a python function: --- title: "An hybrid experiment" output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill runtime: shiny --- ```{r setup, include=FALSE} …
Alexis
  • 2,104
  • 2
  • 19
  • 40
7
votes
1 answer

Reloading Python modules with R reticulate package

I would like to know if there is a way to reload modules imported into R via the reticulate package, similar to the autoreload extension for IPython. For example, suppose I am developing my own module locally, I might import it…
Abiel
  • 5,251
  • 9
  • 54
  • 74
6
votes
1 answer

How to install libpng-dev on Mac

I am trying to install the reticulate package on my Mac and it depends on the png package, which in turn depends on libpng. I installed libpng with brew but the png package fails due to a missing libpng-config: /bin/sh: libpng-config: command not…
Hahnemann
  • 4,378
  • 6
  • 40
  • 64
6
votes
2 answers

System libraries in conda environment not seen by reticulate

I'm trying to get the R package reticulate working on a CentOS 7.8 system using RStudio Server v1.2.5042 with a custom environment created with conda. When I initiate a Python job with reticulate, I get an error that some system libraries are not…
KirkD-CO
  • 1,603
  • 1
  • 22
  • 35
6
votes
1 answer

Install a particular version of python package in a virtualenv created with reticulate

When using reticulate package in order to use Python inside R, we can create a virtualenv thanks to the command reticulate::virtualenv_create specifying env name and the path to the python bin. We can also add packages to the previously created…
Marco Fumagalli
  • 2,307
  • 3
  • 23
  • 41
6
votes
2 answers

No module named 'rpytools'?

I'm trying to work with the reticulate library in R. I used the "functions.py" example to test it out: # functions.py file def add(x, y): return x + y In R studio (Version 3.5.2), this is what I have: library(reticulate) …
stevene97
  • 95
  • 1
  • 4
6
votes
1 answer

Use python 3 in reticulate on shinyapps.io

I have some code in Python 3 which I'm running in R through the reticulate library to use in a shiny app. It works fine in my local machine, but when I published in shinyapps.io reticulate is using Python 2 by default. So far I tried to use…
jcp
  • 749
  • 6
  • 21
6
votes
1 answer

How to make a python variable persist between chunks in a markdown notebook?

Variable are not retained from one chunk to the next in notebook mode, but they are retained when knitting the markdown document to html. I made a sample document available as a gist called pythonvariables.Rmd, the content of this file…
Paul Rougieux
  • 10,289
  • 4
  • 68
  • 110
5
votes
1 answer

Error when using python-kaleido from R to convert plotly graph to static image

I am trying to use the R reticulate package to convert a plotly graph to a static image. I am using save_image/kaleido. Link to documentation for save_image / kaleido Initial…
user2338823
  • 501
  • 1
  • 3
  • 16
5
votes
1 answer

Cross-reference a python code chunk in Rmarkdown with reticulate

I have a Rmarkdown document containing some python code chunks using the reticulate library. The code executes output perfectly; however, how would I cross-reference the generated plots in the text using its label? I am using…
5
votes
1 answer

Module 'scipy.sparse' has no attribute 'linalg' error in reticulate virtual environment

I have written a function which works exactly as I would like it to in python, but when I try and run it in R I run into a problem with reticulate. I have troubleshooted this problem and have reduced it down to this problem. I have this function in…
Hugh Warden
  • 454
  • 4
  • 14
5
votes
1 answer

In R cannot get function from imported python file using reticulate

I would like to import a python file and then use a function within the python file; but it does not work (it only work for source_python). Is it suppose to be this way? In python file called the_py_module.py includes this code: def f1(): return…
John
  • 309
  • 3
  • 12
1
2
3
32 33