Fatal error: Unable to open the base package [closed]

不想你离开。 提交于 2020-06-17 08:14:34

问题


So, now I have managed to compile the hello program of RInside on WindowsXP (VirtualBox). But, when I click on its executable, I get a dialogbox showing the above error.

Searching Google led me to this thread where they were talking about the following settings.

R:

> Sys.getenv("R_LIBS")
[1] ""
> Sys.getenv("R_LIBS_USER")
[1] "C:\\Documents and Settings\\admin\\My Documents/R/win-library/2.15"
> Sys.getenv("R_HOME")
[1] "C:/R-2.15.1"
> sessionInfo ()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
> 

From here: http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-set-environment-variables_003f

The order of precedence for environmental variables is the order in which these options are listed, that is the command line then .Renviron then the inherited environment.

PATH:

enter image description here

Rcmd_environ:

## from R.sh
R_SHARE_DIR=${R_HOME}/share
R_INCLUDE_DIR=${R_HOME}/include
R_DOC_DIR=${R_HOME}/doc
R_ARCH=

## from Rcmd
R_OSTYPE=windows
TEXINPUTS=.;${TEXINPUTS};${R_SHARE_DIR}/texmf/tex/latex;
BIBINPUTS=.;${BIBINPUTS};${R_SHARE_DIR}/texmf/bibtex/bib;
BSTINPUTS=.;${BSTINPUTS};${R_SHARE_DIR}/texmf/bibtex/bst;

## from etc/Renviron
# R_PLATFORM='i386-pc-mingw32'
R_PAPERSIZE_USER=${R_PAPERSIZE}
R_PAPERSIZE=${R_PAPERSIZE-'a4'}
# for Rd2dpf, reference manual
R_RD4PDF=${R_RD4PDF-'times,inconsolata,hyper'}
## used for options("texi2dvi")
# R_TEXI2DVICMD=${R_TEXI2DVICMD-${TEXI2DVI-'texi2dvi'}}
## used by INSTALL, check, build
R_GZIPCMD=${R_GZIPCMD-'gzip'}
## Default zip/unzip commands
R_UNZIPCMD=${R_UNZIPCMD-'unzip'}
R_ZIPCMD=${R_ZIPCMD-'zip'}
R_BZIPCMD=${R_BZIPCMD-'bzip2'}
## Default browser
# R_BROWSER=${R_BROWSER-'open'}
## Default editor
# EDITOR=${EDITOR-${VISUAL-vi}}
## Default pager
# PAGER=${PAGER-''}
## Default PDF viewer
# R_PDFVIEWER=${R_PDFVIEWER-'open'}
# MAKE=${MAKE-make}
SED=${SED-sed}

R_LIBS=c:/DOCUME~1/admin/MYDOCU~1/R/win-library/2.15;

Rprofile:

# Things you might want to change

# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")

# set the default help type
# options(help_type="text")
  options(help_type="html")

# set a site library
.Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")


# set a CRAN mirror
# local({r <- getOption("repos")
#       r["CRAN"] <- "http://my.local.cran"
#       options(repos=r)})

# Give a fortune cookie, but only to interactive sessions
# (This would need the fortunes package to be installed.)
#  if (interactive()) 
#    fortunes::fortune()

Please point out the point that I am missing.


回答1:


This error will get a little help in the next release. What happens is that when the RInside CRAN package gets built, R_HOME is detected and compiled in. With the value of the build machine. Ie not yours.

The answer is to a) build RInside locally so that it stores your R_HOME value or b) to set an enviroment variable R_HOME [ and needed only on Windows as only Windows can give you prebuilt versions ]. In the next version we'll also use some code from R to look in the registry for you; see the SVN repo.

This question has however been asked and addressed numerous times before.



来源:https://stackoverflow.com/questions/13137770/fatal-error-unable-to-open-the-base-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!