Installing optional R packages.

65 views
Skip to first unread message

ancienthart

unread,
Jul 31, 2010, 9:02:47 PM7/31/10
to sage-devel
Hi guys and gals,
I'm having some difficulty installing gstat, automap and sp into the
sage R environment.
I keep getting an error saying that the "sage R include directory is
empty"

Is there a way I can fix this?

Joal Heagney

ancienthart

unread,
Aug 2, 2010, 8:29:24 AM8/2/10
to sage-devel
*sigh*
And I bludgeon the solution out the very next night.
Here is how I got the optional package automap to install into a
binary sage R.

Go into the sage directory and edit the following files:
local/bin/R and local/lib/R/bin/R
and change all the hard-set user variables "/scratch/...." to the true
locations of R_HOME_DIR, R_HOME, R_INCLUDE_DIR, R_SHARE_DIR and for
good measure, R_DOC_DIR. Replace the default string EVERYWHERE in the
file.

I then exported SAGE_HOME as well (Not sure that this is needed.), and
run local/bin/R

Inside R, install.packages("automap")

No more build errors, and when I restart R, automap loads using
library. Just have to try it out from sage now.
Any chance there's a script to find all of these hard-set strings and
change them to correct values?

Joal Heagney

kcrisman

unread,
Aug 2, 2010, 10:34:31 AM8/2/10
to sage-devel
Dear Joal,

Was this a downloaded binary? The variable '/scratch/...' seems to
indicate this is the case. This is usually not a problem on a 'home-
built' one - I've installed lots of R packages using

sage: r.install_packages()

I'm opening a Trac ticket for this, but unfortunately don't know
enough about building to fix it. This is now http://trac.sagemath.org/sage_trac/ticket/9668

Thanks! And glad you were able to get it working.

- kcrisman

ancienthart

unread,
Aug 4, 2010, 4:44:42 AM8/4/10
to sage-devel
Hi kcrisman,
Yes, this was the latest binary release of sage, on an ubuntu
machine,
sage-4.5-linux-64bit-ubuntu_10.04_lts-x86_64-Linux.tar.lzma

I suspect that the only thing I need to change is the R_INCLUDE_HOME=
lines, but when I try to get something working, I don't like to leave
anything to chance. Saves testing and editing time. :)

Joal Heagney

On Aug 3, 12:34 am, kcrisman <kcris...@gmail.com> wrote:
> Dear Joal,
>
> Was this a downloaded binary?  The variable '/scratch/...' seems to
> indicate this is the case.  This is usually not a problem on a 'home-
> built' one - I've installed lots of R packages using
>
> sage: r.install_packages()
>
> I'm opening a Trac ticket for this, but unfortunately don't know
> enough about building to fix it.  This is nowhttp://trac.sagemath.org/sage_trac/ticket/9668

kcrisman

unread,
Aug 4, 2010, 9:14:40 AM8/4/10
to sage-devel


On Aug 4, 4:44 am, ancienthart <joalheag...@gmail.com> wrote:
> Hi kcrisman,
> Yes, this was the latest binary release of sage, on an ubuntu
> machine,
> sage-4.5-linux-64bit-ubuntu_10.04_lts-x86_64-Linux.tar.lzma
>
> I suspect that the only thing I need to change is the R_INCLUDE_HOME=
> lines, but when I try to get something working, I don't like to leave
> anything to chance. Saves testing and editing time. :)

I appreciate that. Still, that sort of hardcoding is bad bad bad,
from everything I've heard. Certainly if it prevents people who don't
understand environment variables (like me) from installing R
packages! Hopefully someone who knows something about this sort of
thing will check it out.

- kcrisman

ancienthart

unread,
Aug 8, 2010, 2:48:30 AM8/8/10
to sage-devel
As a further update for those interested, the above method works in
both binary windows (vmware) and linux versions. However, on Linux, an
easier method is to install sage from the binary, and then reinstall R
from source. This incidentally enables png, jpeg and X11 in R if the
required development libraries are installed.

As follows:
1. Download and install the sage binary into it's final location. (I
put mine in /usr/local/lib, which is why I use sudo in the next couple
of steps.)
2. Make sure png, jpeg and x11 development libraries are installed.
sudo apt-get install libjpeg-dev libpng-dev libx11-dev (on ubuntu
10.04)
3. Start sage with the right permissions.
sudo sage
4. Inside sage, run install_package("R-2.10.1.p2", force=True)
(As an aside, I wish the install_package command would accept package
names without the versions in it. As it is, this step requires me to
go to the sagemath website and see what the version for the default R
spgk is.)
5. Exit sage, restart, and test it out.

Joal Heagney
Reply all
Reply to author
Forward
0 new messages