datasnakes / rut

A cli of r utilities aimed at package and .Rprofile management.
MIT License
4 stars 0 forks source link

Installing R packages with Python. #6

Closed grabear closed 5 years ago

grabear commented 6 years ago

@grabear commented on Fri Apr 27 2018

Look into Rpy2's requirements, and determine if they are acceptable. I think that currently rpy2 is developed for Unix like systems so that might be an important caveat.

Proprietary functions for our CLI will be more work, but in the end we will have more control and less dependencies.

Any other solutions to navigate within R's space would be great.


@sdhutchins commented on Fri Apr 27 2018

I did find another package. I don't know how complicated this would be but pyRserve uses Rserve.

I think it may be too much work to use that for this project.

The other option is to debug rpy2 for Windows...It could be that no one has really put a lot of time into it .


@grabear commented on Mon Apr 30 2018

After installing the windows binaries here And setting the R_HOME environment variable to the appropriate R version (C:\R\R-3.4.3), the following code works from the rpy2 website:

import rpy2.robjects.packages as rpackages

# import R's utility package
utils = rpackages.importr('utils')

# select a mirror for R packages
utils.chooseCRANmirror(ind=1) # select the first mirror in the list
#We are now ready to install packages using R’s own function install.package:

# R package names
packnames = ('ggplot2', 'hexbin', 'devtools')

# R vector of strings
from rpy2.robjects.vectors import StrVector

# Selectively install what needs to be install.
# We are fancy, just because we can.
names_to_install = [x for x in packnames if not rpackages.isinstalled(x)]
if len(names_to_install) > 0:
    utils.install_packages(StrVector(names_to_install))

@sdhutchins commented on Mon Apr 30 2018

Awesome. I think considering we will only be using rpy2 to install packages should be fine. I have had issues with it a bit.


@grabear commented on Mon Apr 30 2018

Luckily this is available:

https://github.com/lepisma/pipwin


@sdhutchins commented on Wed May 02 2018

So definitely rpy2, yes?


@grabear commented on Wed May 02 2018

I think so. Especially with pipwin making it easy to install on Windows.

grabear commented 5 years ago

I just found the spark package manager on GitHub @sdhutchins https://spack.readthedocs.io/en/latest/package_list.html#r

grabear commented 5 years ago

We're not going to use Rpy2. closing for now.