简体   繁体   中英

Mysterious rpy2 with Anaconda (Windows) error

OK, after a lot of Hassle, I finally installed Rpy2 on windows 7 x64.

VERSION INFO:

R version 3.2.0 (2015-04-16) -- "Full of Ingredients" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)

C:\\Anaconda>conda -V conda 3.18.5 C:\\Anaconda>python Python 2.7.10 |Anaconda 2.1.0 (64-bit)| (default, Nov 7 2015, 13:18:40) [MSC v. 1500 64 bit (AMD64)] on win32

Now, it is running, but I had to do strange things How to setup environment variable R_user to use rpy2 in python

So, I have Anaconda and R installed for all users, not just for myself. So this changes things slightly according to that post.

I had to set up environment variables

R_HOME C:\Program Files\R\R-3.2.0\
R_USER C:\Anaconda\Lib\site-packages\rpy2\

When running my program, I get an error in Python:

rpy2.rinterface.RRuntimeError: Error in library(modeltools) : there is no package called 'modeltools'
Error in library(modeltools) : there is no package called 'modeltools'

So I loaded R and modeltools was not installed. So installed modeltools and other necessary packages I found in Python source code.

I even rebooted.

And the error remains. I am totally stumped.

The RRuntimeError is an exception coming from the embedded R: it does not find the package "modeltools". Really.

So now how can this happen while when running R the package is installed ?

  • `rpy2 is linking to a different R
  • the paths in which R packages are installed differs

Try checking if what the R function .libPaths() is returning differs between R, or the R embedded in rpy2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM