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
1
vote
1 answer

Load NPZ sparse matrix in R

How can I read a sparse matrix that I have saved with Python as a *.npz file in R? I already came across two answers* on Stackoverflow but neither seems to do the job in my case. The data set was created with Python from a Pandas data frame…
Stücke
  • 868
  • 3
  • 14
  • 41
1
vote
1 answer

run python script within R

I have 'hello_world.py`: import pandas as pd print('hello world') df=pd.DataFrame({'col':[1,2,3]}) df df.to_csv('hello.csv') I would like to call this script from and R script. Using shell from Run python script from R did not work --> running…
frank
  • 3,036
  • 7
  • 33
  • 65
1
vote
1 answer

Calling python functions in R

I have a Python file that is part of my R project currently, named functions.py. Now I have a series of functions defined in that I would like to call. How would I pass arguments into Python when calling it from R? It seems that if I use…
Daniel
  • 33
  • 4
1
vote
1 answer

How to remove brackets in a reticulate output in R/exams?

I have the following single-choice exercise RadicalPrimo.Rmd, which is intended to simplify square roots: ```{r data generation, echo = FALSE, results = "hide"} library("exams") library("reticulate") # use_python('/usr/bin/python3', required =…
1
vote
0 answers

Transfering dates from python to r with reticulates

I'm using reticulate package to write r and python. When I create dates variable in python and load them in r, with reticulate package, the dates are different. for example: as.POSIXct(py_to_r(r_to_py(as.POSIXct("2020-01-04 06:05:00")))) will give…
1
vote
1 answer

Configuring reticulate to use conda environment

I'm trying to get R's reticulate package to detect the Python interpreter in one of my conda-environments. Following several posts and questions, I've attempted to set the RETICULATE_PYTHON environment variable in .Rprofile (both in user as well as…
1
vote
1 answer

python in Rmarkdown using reticulate cannot read packages

I am using R on a MacBook. I have an Rmarkdown document and I'm trying to use reticulate in order to use python within R. First I download the libraries: ```{r libraries, warning = FALSE, message =…
hachiko
  • 671
  • 7
  • 20
1
vote
0 answers

Error in Sys.setenv(PATH = new_path) : wrong length for argument

after i setenv path, i can't use_condaenv("r-reticulate"); and py_avialable is False enter image description here
Jeffy Ray
  • 21
  • 2
1
vote
0 answers

R session aborted on Ubuntu when using python-reticulate

I am struggling with reticulate. All the time I try to run some python code in a python script, I get the following error. I have tried everything! Latest Rstudio, R, reticulate, Rcpp, Python.... nothing works. I really don't know what I am doing…
user17326436
  • 31
  • 1
  • 3
1
vote
0 answers

R variables not recognized on my Python chunk (reticulate)

My question is pretty naive, but I cannot think of why I am getting this error. I am using the reticulate library to use a python script within R for a project. For a very practical reason, I want to code one last chunk in python. But when i try to…
liliay
  • 13
  • 4
1
vote
0 answers

activate verbose logging with reticulate package

Does anyone know how to activate verbose logging with reticulate package in R? I am trying to load my Python package into R with the following code: version <- "3.7.9" reticulate::install_python(version = version) …
1
vote
0 answers

python code using Reticulate in R notebook is very slow and hangs every time

I have been trying to use reticulate within the R notebook to run the python code. However after running few commands, the python codes are extremely slow and eventually the entire R notebook run crashes. Should I be doing something different to…
saura
  • 41
  • 2
1
vote
2 answers

Cannot get `reticulate` working in MacOS arm64 architecture

I have been trying to use Python in RStudio but apparently, the versions do not match. I have the reticulate version 1.23 installed. I get the following error. > reticulate::repl_python() Error in py_initialize(config$python, config$libpython,…
Harshvardhan
  • 479
  • 1
  • 3
  • 12
1
vote
0 answers

How to set default conda / python environment for R

I'm new to R and shiny. I setup a server and it mostly works, but R code that references the boto3 library fails with "ModuleNotFoundError: No module named 'boto3'" However, if I add this code at the top of the…
Zack
  • 301
  • 1
  • 4
  • 9
1
vote
0 answers

reticulate cannot create symlink - incompatible architectures - Mac M1

Hey everyone and happy new year! I recently bought the M1 MacBook Pro (2020) and I am trying to set it up for some bioinformatics work. While trying to run a function from CellChat package in R that uses Python's umap-learn package, I get the…
geosen
  • 53
  • 5