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

Suppress warnings when using a python chunk inside an Rmd file

I am trying to hide some python warnings when knitting an Rmd file. The usual chunk setup "warning=F, message=F" doesn't seem to work for python chunks. Example of Rmd file with a python chunk that, purposefully, generates warnings: --- title:…
Julien Massardier
  • 1,326
  • 1
  • 11
  • 29
5
votes
0 answers

How to suppress output from info() in Python scripts called by reticulate in R?

I am using the reticulate package to call a Python script from R. The script is being called many times so I would like to suppress output to the console each time it is called. The script I am calling is part of a Python module. It imports the…
qdread
  • 3,389
  • 19
  • 36
5
votes
1 answer

Passing arguments to a python function in reticulate in R

I have problem passing arguments to an imported function from a python module(via reticulate) This code works in python but following code in R does not from frs import frs frs(gender='F', time=10, age=35, bmi=24.3, sbp=122, ht_treat=False,…
anupam
  • 135
  • 1
  • 2
  • 7
5
votes
1 answer

How to properly set the Python path for the reticulate package in OSX High Sierra?

I have installed Python 3.7 in the default location for High Sierra using the official OSX package downloaded from the official Python site. When I run which python3 I get the path /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 I…
The Lyrist
  • 434
  • 3
  • 13
5
votes
2 answers

How to call Python method from R reticulate

reticulate lets you interface with Python from R. In Python, it is common to use (class) methods to interact with your variables. How do I access/execute the method of one Python variable in R when using reticulate? For example, if I create the…
Raniere Silva
  • 2,527
  • 1
  • 18
  • 34
5
votes
3 answers

Can you install a Python package via R - Reticulate

I am about to create a python interface in R with the package Reticulate. In order to access the python functions in R, the respective python packages need to be installed. Two questions came to my mind: 1) If you use the reticulate package, does…
Carmen
  • 763
  • 2
  • 10
  • 22
4
votes
1 answer

reticulate segfaults with call to plt.plot()

I am encountering a segfault when I make a reticulated call to matplotlib.pyplot.plot(). Steps to produce error: Create a Dockerfile with the contents: FROM rocker/r-ver:latest RUN apt update && apt install -y python3.8-venv python3.8-dev RUN…
jwalton
  • 5,286
  • 1
  • 18
  • 36
4
votes
0 answers

Github actions workflow for an R package using reticulate and python dependencies

I'm trying to install python dependencies for automating unit testing within a github repository of an R package that uses reticulate (specifically converting networkx objects to iGraph R objects via json). I'm working from reticulate's…
Griffith Rees
  • 1,285
  • 2
  • 15
  • 24
4
votes
1 answer

Defining a Torch Class in R package "torch"

this post is related to my earlier How to define a Python Class which uses R code, but called from rTorch? . I came across the torch package in R (https://torch.mlverse.org/docs/index.html) which allows to Define a DataSet class definition. Yet, I…
MR_MPI-BGC
  • 265
  • 3
  • 11
4
votes
2 answers

Rmarkdown - python inline code in Rmarkdown

I am using Rmarkdown with python. What is the equivalent of the R inline code for python? Example, in https://rmarkdown.rstudio.com/lesson-4.html I can do ``r x` to display the value of x in the text. but If I do ``python x` I just get the text…
Courvoisier
  • 904
  • 12
  • 26
4
votes
0 answers

How to get reticulate to recognize my miniconda python and my environments?

I am relatively new to python and would like to install it the "right" way (of which, of course, there are many) to use both natively and with R through reticulate. Here's what I have done so far: I reinstalled MacOS Catalina from scratch and…
Tea Tree
  • 882
  • 11
  • 26
4
votes
1 answer

Failing to load package using reticulate::use_virtualenv

I have been trying to run some python code via R reticulate with no success. I tried creating a virtual environment and install two packages in it: numpy and a GitHub package called scrublet. library(reticulate) if(!"r-scrublet" %in%…
Gilad Green
  • 36,708
  • 7
  • 61
  • 95
4
votes
1 answer

R reticulate package not finding Python win32com module

I'm trying to use reticulate in R to access Python's win32com (in order to read password-protected Excel documents), but am failing at the first hurdle. Although my code works fine in Python, when trying to use it in reticulate, the win32com module…
Matt
  • 518
  • 2
  • 5
  • 19
4
votes
1 answer

R Reticulate: 'Unable to locate conda environment' when attempting to use_condaenv(required = TRUE)

I see variations of this question have been asked but none of the answers have resolved my problem. I'm using Windows 10, R version 3.6.2, RStudio version 1.2.5033, reticulate version 1.14 > library(reticulate) > library(dplyr) > conda_list() …
Obed
  • 403
  • 3
  • 12
4
votes
2 answers

Requested version of python cannot be used as another version has been initialized in shiny apps

Getting the error message ERROR: The requested version of Python ('~/.virtualenvs/python_environment/bin/python') cannot be used, as another version of Python ('/usr/bin/python3') has already been initialized. Please restart the R session if you…
Emm
  • 2,367
  • 3
  • 24
  • 50
1 2
3
32 33