Hi folks, I want to install an optional R package from source that I've downloaded from CRAN, say the package /home/mvngu/sna_1.5.tar.gz. Here's my first attempt on Sage 3.2.3:
<begin-error-message> sage: r.install_packages("/home/mvngu/sna_1.5.tar.gz") R version 2.6.1 (2007-11-26) Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > options(repos="http://cran.r-project.org/"); install.packages("/home/mvngu/sna_1.5.tar.gz") Warning: unable to access index for repository http://cran.r-project.org/src/contrib Warning message: In install.packages("/home/mvngu/sna_1.5.tar.gz") : package '/home/mvngu/sna_1.5.tar.gz' is not available > real 0m1.147s user 0m0.952s sys 0m0.036s Please restart Sage or restart the R interface (via r.restart()) in order to use '/home/mvngu/sna_1.5.tar.gz'. <end-error-message> All I understand from the above error message is that I need an Internet connection, especially to http://cran.r-project.org/src/contrib. But the machine I'm using doesn't have Internet connection. OK, no problem. I looked into the Sage <----> R interface file sage-3.2.3/local/lib/python2.5/site-packages/sage/interfaces/r.py and modified the function install_packages() to be as follows: <begin-modified-r.py> def install_packages(self, package_name): """ Install an R package into Sage's R installation. EXAMPLES: sage: r.install_package('Hmisc') #optional requires internet [1] 4 5 6 """ if UNAME == "Darwin": warn = "** You are using OS X. Unfortunately, the R optional package system currently doesn't support OS X very well. We are working on this. **" else: warn = None if warn is not None: print warn cmd = """options(repos="%s"); # install.packages("%s")"""%(RRepositoryURL, package_name) # os.system("time echo '%s' | R --vanilla"%cmd) os.system("/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/bin/R CMD INSTALL /home/mvngu/sna_1.5.tar.gz") print "Please restart Sage or restart the R interface (via r.restart()) in order to use '%s'."%package_name if warn is not None: print warn #s = r.eval('install.packages("%s")'%package_name) #print s <end-modified-r.py> Notice that I uncommented out these lines: install.packages("%s")"""%(RRepositoryURL, package_name) os.system("time echo '%s' | R --vanilla"%cmd) and added the following quick-and-dirty fix: os.system("/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/bin/R CMD INSTALL /home/mvngu/sna_1.5.tar.gz") I exited Sage and issued a re-build of modified Sage library files with $ sage -br main Then I loaded Sage again for another attempt at installing sna_1.5.tar.gz: <begin-error-message> sage: r.install_packages("abc doesn't matter what name you put here!") * Installing to library '/home/mvngu/usr/bin/sage-3.2.3/local/lib/R//library' WARNING: ignoring environment value of R_HOME * Installing *source* package 'sna' ... ** libs gcc -std=gnu99 -I/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/include -I/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/include -I/home/mvngu/usr/bin/sage-3.2.3/local/inlcude WARNING: ignoring environment value of R_HOME -fpic -I/home/mvngu/usr/bin/sage-3.2.3/local/include -L/home/mvngu/usr/bin/sage-3.2.3/local/lib/ -c components.c -o components.o gcc: WARNING:: No such file or directory gcc: ignoring: No such file or directory gcc: environment: No such file or directory gcc: value: No such file or directory gcc: of: No such file or directory gcc: R_HOME: No such file or directory make: *** [components.o] Error 1 ERROR: compilation failed for package 'sna' ** Removing '/home/mvngu/usr/bin/sage-3.2.3/local/lib/R/library/sna' Please restart Sage or restart the R interface (via r.restart()) in order to use 'abc'. <end-error-message> The closest problems to mine that I can locate are http://groups.google.com/group/sage-support/browse_thread/thread/2c0ef9eb24e8dd53/2c559b00b3585b18 in sage-devel and this one in sage-support: http://groups.google.com/group/sage-support/browse_thread/thread/881b23030c56f48d/4d28b33aa01bfb63 But they don't seem to have any work around I can use, especially when the tickets #4959 and #1476 they spawned as yet either haven't been resolved or closed as "worksforme". Does anyone have a suggestion I can try to install sna_1.5.tar.gz? -- Regards Minh Van Nguyen --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---