1

I started using conda environments. I know that I can open and use R jupiter notebook, but my preferred workflow is to use R within a python notebook, when necessary, with rpy2 and push/pull data between the two languages

%R push data
%R run something
%R pull output

however now when I run rpy2 in a conda environment, it searches for all packages in the R folder within the conda environment. I would like to use the packages installed in my home directory or those from the machine I work on, without the need to reinstall everything for each conda environment. Is that possible?

claude
  • 549
  • 8
  • 25

1 Answers1

1

There are several ways to tell R about package directories (http://stat.ethz.ch/R-manual/R-devel/library/base/html/libPaths.html).

Try setting the environment variable R_LIBS or R_LIBS_USER (before %load_ext rpy2.ipython in the notebook).

lgautier
  • 11,363
  • 29
  • 42
  • this is a hack that will not always work (the R process will still dynamically load shared libraries [=\= R packages] from the conda environment) – jan-glx Feb 06 '19 at 13:24