[R-pkg-devel] adding rPython as a suggested package

Bruce Hoff bruce.hoff at sagebase.org
Sat Dec 2 16:29:25 CET 2017


Just a comment tangentially related to this topic:  There are a number of R
packages for calling Python from R, including the "rPython" and
"reticulate" packages mentioned in this thread.  Another is "PythonInR".  (
https://cran.r-project.org/web/packages/PythonInR/index.html).  These
packages address the problem of invoking a Python module or package which
is installed on the user's machine.  I.e., they answer the question, "How
can I access from R a suite of useful Python tools I have configured in my
workspace?"  There is a complementary question, "How can I expose in an R
package specific functionality written in Python?"  In the latter case the
Python function is written specifically for the R package and the R package
should be *isolated* from any installed Python environment.  The package
should not change any installed Python environment and anything you do in
Python should not affect how the R package executes.

We have addressed this second problem with a package PythonEmbedInR (
https://github.com/Sage-Bionetworks/PythonEmbedInR).  This is a
modification of PythonInR which *embeds* a hidden/private copy of Python 3
within the R package, totally isolated from any other Python runtime
concurrently installed on the machine.  Further it works *cross platform*
(Linux, Windows and MacOS).  We build the package binaries and host them
using Github pages, so to install you simply add to your list of CRAN
repo's, "https://sage-bionetworks.github.io/ran". You need not build from
source to use the package on Windows or Mac.  This is significant because
building the package also builds the Python runtime.

Any questions, please ask.

Bruce Hoff
Sage Bionetworks

2017-12-01 7:50 GMT+01:00 Slava Lyubchich <lyubchich at umces.edu>:
> Hello,
> I have a package on CRAN (funtimes) and I am trying to add a function
> that uses some Python code (only one function in the package needs
> Python, others do not). In order to do that, I
> 1) add in the DESCRIPTION
> Suggests: rPython
> 2) in the R function, use
> rPython::python.load("CRAD.py")
> 3) put CRAD.py  in the top folder of the package (together with
> The automatic CRAN check returns it with notes:
> -- Package suggested but not available for checking: 'rPython'

rPython is not available for Windows. You can see "OS_type: unix" in
its DESCRIPTION. If you want to support Windows systems, take a look
at the reticulate package, which is another R interface to Python.

> -- Non-standard file/directory found at top level:   'CRAD.py'

Create an inst/ directory and put it there, as suggested in "1.1.7
Non-R scripts in packages" in the "Writing R Extensions" manual.


> Could you recommend how to fix that? Where should I move to the
> additional file with code?
> https://cran.r-project.org/package=rPython
> <https://cran.r-project.org/package=rPython>
> Best regards,
> Slava
> --
> V. Lyubchich
> Research Assistant Professor
> Chesapeake Biological Laboratory
> University of Maryland Center for Environmental Science

	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list