Ask Your Question
1

Can't Install R Packages in Sage

asked 2013-04-14 13:28:46 -0500

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 16:14:08 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-04-14 13:36:04 -0500

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 13:44:54 -0500 )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 16:15:46 -0500 )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 07:48:07 -0500 )edit
1

answered 2013-09-14 19:37:09 -0500

JoalHeagney gravatar image

updated 2013-09-14 19:37:54 -0500

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 02:47:48 -0500 )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 13:28:46 -0500

Seen: 576 times

Last updated: Sep 14 '13