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
2
votes
0 answers

Converting and R object defined inside of a function to a Python object fails using Reticulate in RMarkdown

I want to write an R function in RMarkdown, where I declare an R object inside the function and then convert this object to a Python object that I then pass to a Python function. However, during the conversion part I get and error in…
Peter
  • 191
  • 2
  • 8
2
votes
1 answer

Can't declare a python function in Rstudio/Rmarkdown

I am trying to execute a python code in Rstudio (Rmarkdown) in a python chunk and I cannot declare a function while I am getting an error: IndentationError: unexpected indent (, line 1) (I am not mixing tabs with spaces or so) The following code…
Sin
  • 135
  • 1
  • 9
2
votes
1 answer

Using environmental variables with R reticulate

I have a Python package that I want to use in R via reticulate. However, that Python function doesn't appear to see the environmental variables from the R environment. How can I successfully set an environmental variable for the Python function to…
Jacqueline Nolis
  • 1,457
  • 15
  • 22
2
votes
1 answer

Use reticulate to access an R object in a new environment

The following gives the expected result (executed in the global environment): library(reticulate) x <- 1 py_run_string("r.x = 2") #> x #[1] 2 However, when I try to access an object from a new environment, the python code is "run" in my global…
v44k3
  • 113
  • 1
  • 6
2
votes
1 answer

Problems with deployment of shiny app due to reticulate_python

I have an app that I want to deploy on shinyapps.io. I think it is important to note that in the app data is extracted from a database in athena. I used the package Rathena to connect to the database and everything used to run fine locally from my…
Nick
  • 369
  • 1
  • 3
  • 18
2
votes
0 answers

Python chunk echos in r-markdown, but not r-notebook

I like to take notes inside of r-notebooks and have recently been trying to incorporate python code chunks into some of my documents. I have no problems executing python chunks and displaying the output, but I get different behavior depending on…
bds
  • 51
  • 4
2
votes
2 answers

from import from python in reticulate

Any way to do the from - import from Python in Reticulate without having to import the whole module? example: from tensorflow import keras I know about the solution below, but it imports the whole module anyway... keras <-…
daniellga
  • 1,142
  • 6
  • 16
2
votes
0 answers

Can't import python packages in R reticulate

I have tried absolutely everything I could think of to try and figure this out. I followed this video exactly, created a new conda environment, installed the packages I want to use, and tried to import the packages. I get this error when I try to…
bismo
  • 1,257
  • 1
  • 16
  • 36
2
votes
3 answers

How to import python packages using Reticulate in R

I have been learning python for about a year now. I just downloaded R to try using Python with Reticulate. I have all of my python packages pip installed in an anaconda base environment named base. I am getting everything to work except pandas. It’s…
bismo
  • 1,257
  • 1
  • 16
  • 36
2
votes
1 answer

Python Virtual Environments Confusion

I have been learning data science using python for about a year now. I have become quite comfortable with the syntax and model creation. I have exclusively used Google Colab just due to how convenient it is and I love the notebook style. However,…
bismo
  • 1,257
  • 1
  • 16
  • 36
2
votes
1 answer

How to run python in R

I want to configure Rstudio and python so that I can work on R markdown files and use python code in Rstudio as I want to take advantage of the ggplot2 package. My current R markdown file is as follows: --- title: "plottingpython" output:…
Joe Emmens
  • 135
  • 13
2
votes
0 answers

In R testthat gives error when testing function including reticulate::source_python

I want to test a function with testthat that includes sourcing a python file with reticulate. However, I get the error: Exited with status 9. This is the python example file called the_py_module.py with function that I want to source. def f1(): …
John
  • 309
  • 3
  • 12
2
votes
1 answer

GPU memory leakage when creating objects from sentence-transformers

Description I am creating a function in R that embeds sentences using the sentence_transformers library from Python. For some unknown reason, creating the object multiple times under the same variable name ends up in insufficient memory space to…
Luisda
  • 190
  • 13
2
votes
0 answers

Can the reticulate package display images in IPython.display?

I have this code: from IPython.display import display, Image url = 'http://upload.wikimedia.org/wikipedia/commons/5/56/Kosaciec_szczecinkowaty_Iris_setosa.jpg' (Image(url,width=300, height=300)) When I put the code in a jupyter notebook it…
2
votes
0 answers

Problem with accessing virtual environment Python from R Markdown

Note: I'm on Windows using Git Bash. So, I am trying to setup a dev environment for the work for my class. It is going to involve a combination of coding in R and Python. I created virtual environments using pipenv and virtualenv and ran into the…
Ramin Melikov
  • 967
  • 8
  • 14