Questions tagged [reticulate]
Usage questions regarding reticulate R package which provides a comprehensive set of tools for interoperability between Python and R.
501
questions
1
vote
1
answer
36
views
R Markdown knit error when using shap library
I tried to knit my R markdown document in to flex dashboard but I keep getting the following error when trying to import 'shap' package in python chunk of code:
Quitting from lines 45-46 [unnamed-...
0
votes
0
answers
30
views
Docker with Rstudio & conda virtual env - unable to load R packages
I have this dockerfile:
# Use the rocker/rstudio image with R version 4.1.2
FROM rocker/rstudio:4.1.2
# Install deps
RUN apt-get update && apt-get install -y \
wget \
bzip2 \
bash-...
-1
votes
0
answers
37
views
Problem with Rmarkdown, reticulate and python in Pycharm
I want to create a pdf report.
I tried to install Openpyxl many times but it didn't work.
The python code works without Openpyxl.
title: "Statistique Masse sous gestion"
author: "...
0
votes
0
answers
59
views
Is there a way to use/install reticulate/RcppTOML with an older version of C++/without C++17?
I am currently working on a project where I am attempting to run my R script remotely on a campus computer cluster. As such, I don't have sudo privileges and cannot change the R configuration file. I ...
0
votes
1
answer
63
views
Run a Python script within a Shiny app using reticulate
I want to create a Shiny app and within the app I want to run a Python script. This Python script should take parameters previously defined in the App. But the Python script does not seem to recognize ...
0
votes
2
answers
115
views
How to stop the annoying warnings output by reticulate in R
I am trying to read a pickle data in R, I have following R code:
library(reticulate)
pd <- suppressMessages(import("pandas"))
hubs.data <- suppressWarnings(pd$read_pickle("input....
0
votes
0
answers
9
views
To deploy Shinyapps.io with sourcing Python script local tryCatch error
I have built R application with sourcing Python script. I use Python3.8 and setup virtual Python environment.
First, I understand that if use Python3.8, it isn't necessary to setup virtual environment....
0
votes
0
answers
38
views
reticulate can not find systemwide installed python package
I am on Fedora 38 linux and I have systemide installations of matplotlib (python3-matplotlib). However, I can not seem to be able to find it using reticulate. I tried:
library(reticulate)
mp <- ...
1
vote
0
answers
85
views
Issues installing NeuralProphet in .conda env - error building wheel
I am new to python, but I am trying to install neural prophet to use through reticulate in R, and I'm having issues getting it installed.
I tried doing pip install of neural prophet, and it will not ...
4
votes
2
answers
140
views
Run external program inside a conda environment in R
I am trying to run stitchr in R. For programs that run in Python, I use reticulate. I create a conda environment named r-reticulate, where I want to install stitchr and run it.
I try the following:
if ...
1
vote
2
answers
96
views
R Reticulate--Use Python Module with Tidyverse Mutate
I'd like to use the tiktoken python module with the R tidyverse mutate function. The module works fine on its own but throws an error when used in a tidyverse mutate statement. The error is:
Error in ...
1
vote
0
answers
37
views
Using `arcgisbinding` and `reticulate` to run R code and python within a Quarto document
Background
I am a long-time R user but completely new to python. I have used the arcgisbinding package successfully for several years and I am happy with how it is working - I am connecting to my AGOL ...
0
votes
0
answers
66
views
Error in py_run_file_impl(file, local, convert) : NameError: name '_C' is not defined
I've been using text package on another laptop and everything runs smoothly. However, on a different laptop, I've been trying to install the package -I have reinstall it, reinstall r as well - but ...
0
votes
0
answers
75
views
Python script in R reticulate: Error in py_run_file_impl(file, local, convert) : SystemExit: 2
I have a Python script that I want to use in my R code (to calculate a certain amount of precipitation at specified location (coordinate)).
I already used this code:
setwd('C:/Users/username/Documents'...
2
votes
1
answer
40
views
Running tslearn via reticulate leads to TypeError
I am trying to run TimeSeriesKMeans from TSlearn via reticulate but apparently fail to properly convert my R data.frame to a numpy array. Full code and error below. Please have a look what I do wrong. ...
0
votes
0
answers
24
views
Error deploying shiny app using reticulate to shiny.io
I've built an app with Shiny which uses machine learning to perform a semantic search on a collection of documents. The app uses reticulate to access the huggingface sentence-transformers library. The ...
1
vote
0
answers
85
views
Python in R with reticulate - Numpy [NOT FOUND]
I am trying to use the reticulate package in R, which allows Python code within the R environment. Unfortunately I ran into the following problem: even though I have installed the Numpy package from ...
1
vote
0
answers
46
views
Using keras and tensorflow in R with reticulate to use SVM
I am able to do svm in R using the e1071 package. I want to do the same using tensorflow through R and keras, but I am a bit lost as to whether this could be done.
## let us simulate some two-class ...
0
votes
0
answers
43
views
Shiny app using Reticulate not deploying to shiny.io because of error: utils::tar(... : storing paths of more than 100 bytes is not portable
I am trying to deploy a Shiny app that is using Reticulate to access a huggingface SentenceTransformers model to undertake a semantic search. I can get the app running locally, however, when trying to ...
0
votes
1
answer
62
views
Having Python Files in an R package- Where do I put it?
I am working on a R package and for various reasons I need to write some code in Python.
For my current workflow I have the various scripts sitting in the root directory which I run in my various R ...
0
votes
0
answers
43
views
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found when loading pandas in reticulate
I have seen this posted a few times but I haven't seen a clear answer that is working for my situation, so forgive me if reposting (see: https://community.rstudio.com/t/reticulate-issues-in-rstudio-...
0
votes
0
answers
71
views
How to force reticulate to use WSL2 Ubuntu conda environment on a Windows installation of R
I'm currently running R+RStudio on a Windows machine. I have WSL2 installed with an Ubuntu environment set up. Within that environment I have a number of mamba environments that I use for various jobs....
2
votes
0
answers
2k
views
setup reticulate virtual environment with python 3.11.4
I have Python 3.11.4 installed. I have also installed keras package. I was trying to create a virtual environment but the command wants to install a new version of python (3.9). Is it possible to use ...
0
votes
1
answer
45
views
Using Articulate to run Python API in R, running undefinable strings
I am looking to run the following Python API in R
https://github.com/uncomtrade/comtradeapicall
I have used reticulate for this.
One piece of code that calls the API is following:
In Python
mydf = ...
0
votes
1
answer
69
views
Best way to access R-objects using py_run_string for use in R package
I am developing a package that needs to access user-created R-objects from within Python. Unfortunately, users in R can create objects with symbols that Python does not like (e.g. df$col.name). When ...
0
votes
1
answer
111
views
Importing Python packages in RStudio QMD
Very new to Python and R, so apologies for probably a very basic question. Attempting to install numpy and pandas in RStudio .qmd file. I have referenced other similar questions, but I'm continuing to ...
2
votes
1
answer
113
views
Problem with using Python via R's reticulate in Docker container
I create a Docker image based on rocker/shinyversewith the Dockerfile:
# File: Dockerfile
FROM rocker/shiny-verse:4.2.2
RUN echo "apt-get start"
RUN apt-get update && apt-get ...
0
votes
1
answer
67
views
Convert datetime.time in Python to time class in R
I am reading a python dataframe into R and generating some Rmd reports. I use reticulate with condaenv to call py_run_file to run the python script that generates the dataframe. The python script uses ...
1
vote
1
answer
71
views
running Python script using system2() works in R terminal but not RStudio
Given a simple python script, "test.py":
from sys import stdout
stdout.write("text out")
Calling this from the R terminal using system2() works as expected:
python <- "C:/...
0
votes
0
answers
44
views
resolving a reticulate conda normalizePath error
I recently switched the conda solver from classic to libmamba. Then I removed mamba. Conda seems to work fine, but I started getting a reticulate error in R:
> reticulate::use_condaenv("base&...
0
votes
0
answers
43
views
R: Reticulate conda_create() does not create a new environment at the specified miniconda path
I have installed miniconda in a specified filedrive;
install_miniconda(path = "D:/miniconda", update = T)
* Miniconda has been successfully installed at "D:/miniconda".
[1] "...
1
vote
0
answers
72
views
R reticulate on M1 Mac OSX
Python 3.11.3 and R4.3.0
Upon loading any package, already installed via py_install or pip on the terminal, I get this weird error. I don't even know where to start. Somehow rpytools doesn't seem to ...
1
vote
1
answer
65
views
Unexpected syntax error after loading reticulate package
I've loaded "reticulate" package to run python code in Rstudio.
Below the code:
# Initialize an empty dictionary
D = {}
L = [['a', 1], ['b', 2], ['a', 3], ['c', 4]]
I get the following ...
0
votes
0
answers
60
views
python code in bookdown Rmarkdown does not run
I am trying to run some python code in rmarkdown using bookdown by copying this github repo - https://github.com/rstudio/bookdown-demo. Everything looks ok when I knit the book either in HTML or PDF. ...
0
votes
0
answers
105
views
Getting numpy to run in parallel
I'm trying to use the scanorama package in R and am having some troubles with the parallelization. The readme of the scanorama package links to this set of instructions for how to make sure numpy is ...
0
votes
0
answers
33
views
Using openturns from R via reticulate
I am trying to use functions from the openturns Python package from R. I believe it should be possible to install and import Python packages using the R-package reticulate, but it does not seem to ...
0
votes
0
answers
296
views
Conda SSL Error while trying to py_install
I try the following codes in R (Windows):
reticulate::py_install("capiq-excel", repos = "https://pypi.org/simple/",
extra_args = c("--trusted-host",...
0
votes
0
answers
126
views
Error: ModuleNotFoundError: No module named 'localLibrary' when trying to run a python script from R with reticulate
I am trying to execute a python script via R using the following lines of code:
library(reticulate)
py_install("pandas")
py_run_file("pathToPythonScript/Script.py")
The script ...
0
votes
1
answer
60
views
Python script to read csv-file from `inst` folder within custom R package
I am building a R package that uses a Python script which in turn loads internal data. Both the py-script (load_csv.py) as well as the data (data.csv) are located in the inst/ folder of the package ...
0
votes
0
answers
360
views
install_python() raises Error in setwd(root) : cannot change working directory
I was following the code at https://tensorflow.rstudio.com/install/. Then I encountered the following error that stopped me from continue.
> library(reticulate)
> path_to_python <- ...
0
votes
0
answers
28
views
Reticulate wrongly translating values of a column
Right now I'm working in a .Rmd file and using reticulate so I can combine both Python and R chunks.
Initially, I'm getting a dataframe like this one below.
id device sessions
1 mobile ...
0
votes
0
answers
74
views
Mutate error with python and mutate? Error in mutate(), caused by error: "SystemError: <class 'super'> returned a result with an error set"
I'm trying to implement a sentiment analysis using reticulate and huggingfaceR in my database, this code already worked previously, but now that I try to implement it to create a new variable it ...
0
votes
0
answers
122
views
Reticulate sees some (but not all) python packages using Rstudio on Ubuntu
Setting a conda environment (in this case named r420v1 where python is in "/home/tjm/anaconda3/envs/r420v1/bin/python3" ) in reticulate "works" in that it sets the appropriate ...
0
votes
0
answers
209
views
NameError: name 'scipy' is not defined. Cant figure out correct code
Error: NameError: name 'scipy' is not defined.
history <- model %>% fit(
train_generator,
steps_per_epoch = 100,
epochs = 30,
validation_data = validation_generator,
validation_steps = ...
0
votes
0
answers
302
views
R install tensorflow and keras
I am trying to install the keras and tensorflow libraries from R. I have followed the official instructions from the RStudio website and other similar ways.
When I finish following all the steps and ...
0
votes
0
answers
48
views
How to source a python file (via R reticulate package) without freezing python?
I want to run an example from the multiprocessing module via the reticulate Package in R (content of the Pool.py file used for sourcing):
from multiprocessing import Pool
def f(x):
return x*x
if ...
0
votes
0
answers
28
views
R object class is coerced to function in py object using {reticulate} to create a {learnr} tutorial
I'm not able to get the correct type of an R object which I need to use in a Python object while creating a learnr tutorial in R. I attached an image where I tried to present to you a sample example ...
1
vote
1
answer
290
views
Unable to load pandas in R reticulate due to missing GLIBCXX_3.4.29
I'm trying to use R's reticulate package for loading python's pandas package in R.
I have python3.8, and I installed pandas through conda. In python pandas imports fine but in R, after loading ...
0
votes
0
answers
56
views
Getting an error while trying to use 'spacyr' library in R
Getting the below error while trying to use spacyr in R:
spacy_initialize("en_core_web_sm") Found 'spacy_condaenv'. spacyr will use this environment Error: OSError: [E050] Can't find model '...
0
votes
1
answer
103
views
Import Python logistic regression results into R using
Because Python uses multiple cores and is more efficient with memory, I would like to run logistic regression in Python, but then import the summary table to R (as in the end is used in a Quarto ...