Ask Your Question
1

Can't Install R Packages in Sage

asked 2013-04-14 20:28:46 +0100

jaia gravatar image

I'm running Sage 5.8 on Ubuntu 12.10 and am trying to install some R packages within Sage. However, when I enter

%r
install.packages("deSolve")

I get a green line and nothing happens. I am not asked what repository I'd like to use; when I specified a repository, I still got a green line and nothing happened. If I leave out the package name, I get a pop-up asking what package I want to install but nothing after that. What should I do?

edit retag flag offensive close merge delete

Comments

Ordinarily this should work fine - I've done it live in talks. Did you download a binary or build from source? Any other information about your install would be very helpful.

kcrisman gravatar imagekcrisman ( 2013-04-14 23:14:08 +0100 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2013-04-14 20:36:04 +0100

slelievre gravatar image

Launch R instead of Sage, by using the following command in a terminal window.

$ sage -R

You can then install the R packages. Once installed, you can use them in Sage.

edit flag offensive delete link more

Comments

That partly works, but now I get warnings about the R include directory being empty and then an error that says compilation failed.

jaia gravatar imagejaia ( 2013-04-14 20:44:54 +0100 )edit
1

OK, solved it. I installed the new spkg at http://boxen.math.washington.edu/home/palmieri/SPKG/r-2.15.2.p2.spkg. (For anyone who doesn't know how to do this, in Ubuntu I ran sudo sage -i http://boxen.math.washington.edu/home/palmieri/SPKG/r-2.15.2.p2.spkg .)

jaia gravatar imagejaia ( 2013-04-14 23:15:46 +0100 )edit

@jaia: Did you have bad hardcoded paths before, or was there some other problem? We would love to add you to the reviewer list at http://trac.sagemath.org/sage_trac/ticket/9668 if this solved the problem based on what that package was for!

kcrisman gravatar imagekcrisman ( 2013-04-16 14:48:07 +0100 )edit
1

answered 2013-09-15 02:37:09 +0100

JoalHeagney gravatar image

updated 2013-09-15 02:37:54 +0100

I had these issues when first using the binary versions of sagemath. Installing wouldn't work, and the "include directories are empty" message would pop up in sage -R.

Solved it by using the command: sage -fr to force-rebuild the R package. Make sure you have all the build dependencies for libpng, libjpeg, cairo, etc. installed.

Then I could use install.packages("...") from sage -R, the notebook in R mode, or %r-cell mode with no issues.

Now I use a source build/updated version of sage instead.

edit flag offensive delete link more

Comments

Good catch - sometimes it's not clear whether users are using a binary or Sage built from source!

kcrisman gravatar imagekcrisman ( 2013-09-16 09:47:48 +0100 )edit

I've also found recently that with sage version 7.6, install.packages won't work unless I specifically set method='wget'. This is using a http mirror, but I don't know if that has anything to do with it.

E.g.

install.packages('automap',method='wget')

Otherwise it complains that it doesn't have a version of that package for the version of R included with sagemath.

E.g.

package ‘automap' is not available (for R version 3.2.4 Revised)

JoalHeagney gravatar imageJoalHeagney ( 2017-05-27 01:23:03 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-04-14 20:28:46 +0100

Seen: 1,428 times

Last updated: Sep 15 '13