reticulate

Error – cannot install Miniconda with RStudio

Error – cannot install Miniconda with RStudio Question: I have written a R script where I use some python lines through the reticulate package. I need to share it with some colleagues who don’t know about programming and I’ve created a batch file so I can run it without them even opening R. However, I …

Total answers: 1

How to activate existing Python environment with R reticulate

How to activate existing Python environment with R reticulate Question: I have the following existing Python environments: $ conda info –envs base * /home/ubuntu/anaconda3 tensorflow2_latest_p37 /home/ubuntu/anaconda3/envs/tensorflow2_latest_p37 What I want to do is to activate tensorflow2_latest_p37 environment and use it in R code. I tried the following code: library(reticulate) use_condaenv( "tensorflow2_latest_p37") library(tensorflow) tf$constant("Hello Tensorflow!") But it …

Total answers: 1

R Reticulate – Moving defined variables programmatically from Python environment to R

R Reticulate – Moving defined variables programmatically from Python environment to R Question: Caue: I’m creating dataframes programmatically in Python using globals(). In the below code, I’m creating 5 datasets that starts with a ‘PREFIX’ in caps, followed by a letter then ending with a suffix. R library(reticulate) repl_python() Python import os import pandas as …

Total answers: 1

Calling python functions in R

Calling python functions in R Question: 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 system(‘python …

Total answers: 2

python in Rmarkdown using reticulate cannot read packages

python in Rmarkdown using reticulate cannot read packages Question: 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 = FALSE} library(dplyr) library(reticulate) “` Next I look at an …

Total answers: 2

Cannot get `reticulate` working in MacOS arm64 architecture

Cannot get `reticulate` working in MacOS arm64 architecture Question: 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, config$pythonhome, : /Users/harshvardhan/opt/anaconda3/lib/libpython3.8.dylib – dlopen(/Users/harshvardhan/opt/anaconda3/lib/libpython3.8.dylib, 0x000A): tried: ‘/Users/harshvardhan/opt/anaconda3/lib/libpython3.8.dylib’ (mach-o file, but is …

Total answers: 2

System libraries in conda environment not seen by reticulate

System libraries in conda environment not seen by reticulate Question: 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 the correct …

Total answers: 2

R reticulate libstdc++so GLIBCXX_3.4.21 not found issue

R reticulate libstdc++so GLIBCXX_3.4.21 not found issue Question: I was trying to use pandas from R . I used the reticulate library for the same. The sample code I used is given below library(reticulate) use_condaenv(“my_env_37”,required=T) py_discover_config() py_run_string(“import pandas as pd”) Error > py_run_string(“import pandas as pd”) Error in py_run_string_impl(code, local, convert) : ImportError: /lib64/libstdc++.so.6: version …

Total answers: 2