4

I usually ran different statistical analysis in R with routines that use lapack like gam() lm(), etc but after several updates of libraries the following error appears:

library(mgcv)
This is mgcv 1.7-22. For overview type 'help("mgcv-package")'.
model <- with(chlaR,gam(ClorMAX ~ s(DegDay_NM)))
Error en eigen(St, symmetric = TRUE) : 
lapack routines  cannot be loaded
Además: Mensajes de aviso perdidos
In eigen(St, symmetric = TRUE) :
  unable to load shared object '/usr/lib/R/modules//lapack.so':
  /usr/lib/R/modules//lapack.so: undefined symbol: dpstrf_

The version information is:

platform       i686-pc-linux-gnu            
arch           i686                         
os             linux-gnu                    
system         i686, linux-gnu              
status                                      
major          2                            
minor          15.2                         
year           2012                         
month          10                           
day            26                           
svn rev        61015                        
language       R             

I am using Ubuntu 12.04.1 LTS

UPDATE: I have checked the lapack.so library

leonardo@LyP:~$ ldd  /usr/lib/R/modules/lapack.so
linux-gate.so.1 =>  (0x009ec000)
libR.so => /usr/lib/libR.so (0x0023a000)
liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00ba3000)
libblas.so.3gf => /usr/lib/libblas.so.3gf (0x00186000)
...

checking the object

leonardo@LyP:~$ R CMD objdump -T /usr/lib/liblapack.so.3gf|grep dpstrf
00327f10 g    DF .text  000024d4  Base        dpstrf_

but

R CMD ldd /usr/lib/R/modules/lapack.so
linux-gate.so.1 =>  (0x009f5000)
libR.so => /usr/lib/R/lib/libR.so (0x00110000)
liblapack.so.3gf => /usr/lib/R/lib/liblapack.so.3gf (0x009f6000)
libblas.so.3gf => /usr/lib/R/lib/libblas.so.3gf (0x11eef000)

R links to another library and searching for the object:

leonardo@LyP:~$ R CMD objdump -T /usr/lib/R/lib/liblapack.so.3gf|grep dpstrf

gives empty

Any ideas?

llrs
  • 3,308
  • 35
  • 68
Leosar
  • 2,010
  • 4
  • 21
  • 32
  • Does `R CMD objdump -T /usr/lib/liblapack.so.3gf|grep dpstrf` say something sensible? Also, though I doubt it's the problem, you want to `R CMD ldd /usr/lib/R/modules/lapack.so` to get ldd to run in the environment that R sets up. – Martin Morgan Nov 24 '12 at 21:25
  • it find the object: `R CMD objdump -T /usr/lib/liblapack.so.3gf|grep dpstrf 00327f10 g DF .text 000024d4 Base dpstrf_` – Leosar Nov 24 '12 at 23:19
  • And there aren't surprises from `R CMD env|grep R_HOME` or R CMD ldd /usr/lib/R/modules/lapack.so` (on the appropriate path)? – Martin Morgan Nov 24 '12 at 23:58
  • No surprises I think: `leonardo@LyP:~$ R CMD ldd /usr/lib/R/modules/lapack.so linux-gate.so.1 => (0x009f5000) libR.so => /usr/lib/R/lib/libR.so (0x00110000) liblapack.so.3gf => /usr/lib/R/lib/liblapack.so.3gf (0x009f6000) libblas.so.3gf => /usr/lib/R/lib/libblas.so.3gf (0x11eef000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x00759000) /lib/ld-linux.so.2 (0x009be000) libguide.so => /usr/lib/R/lib/libguide.so (0x00774000) libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0x007d6000) ...` – Leosar Nov 25 '12 at 00:19
  • It's hard to parse your comment; you can edit your original post. It looks like you're linking to `/usr/lib/R/lib/liblapack.so.3gf` which is different from above, and different from your `objdump`. Make everything consistent. – Martin Morgan Nov 25 '12 at 00:24
  • Thanks, I added it to the post, there are different versions of the library but I don't know how to solve that. – Leosar Nov 25 '12 at 01:50
  • I don't know the solution either, but at least you know now that R was installed in such a way as to link at run-time to an incomplete version of liblapack.so. Maybe an ubuntu person like @DirkEddelbuettel or on the [r-sig-debian](https://stat.ethz.ch/mailman/listinfo/r-sig-debian) mailing list can take you from here. – Martin Morgan Nov 25 '12 at 05:46

4 Answers4

3

I had the same problem and I tracked it to a conflict with the revolution-mkl package

sudo apt-get remove revolution-mkl

fixed the problem

2

I uninstall R using synaptics and marking all r-base and r-cran packages, reinstall it with

sudo apt-get install r-base r-base-dev r-base-html

and that's it, everything work fine.

Thanks to all the commenters!

Leosar
  • 2,010
  • 4
  • 21
  • 32
0

Where did your mgcv package come from? CRAN as source? CRAN as a r-cran-mgcv via Michael's rebuild of my Debian package?

On my Ubuntu box, using the standard Ubuntu repo on CRAN, all is well:

edd@max:~$ ldd /usr/lib/R/library/mgcv/libs/mgcv.so 
        linux-vdso.so.1 =>  (0x00007ffff43ff000)
        liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00007f0374f75000)
        libblas.so.3gf => /usr/lib/libblas.so.3gf (0x00007f0373ad6000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f03737d9000)
        libR.so => /usr/lib/libR.so (0x00007f0373215000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0372e56000)
        libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f0372b3e000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0372928000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f037270b000)
        libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007f03724c8000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f037228b000)
        liblzma.so.5 => /usr/lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f0372069000)
        libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f0371e58000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0371c41000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0371a39000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0371834000)
        libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f0371626000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0375de2000)
        libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f03713f0000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f03711c8000)
edd@max:~$ 

and

edd@max:~$ R

R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

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.

R> library(mgcv)
This is mgcv 1.7-22. For overview type 'help("mgcv-package")'.
R> 
Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • I installed mgcv with install.packages(mgcv) but is not only a problem of mgcv `model <- lm(ClorMAX ~., data=chlaR) summary(model) Error en chol2inv(Qr$qr[p1, p1, drop = FALSE]) : rutinas lapack cannot be loaded` – Leosar Nov 21 '12 at 00:03
  • Do you think uninstalling R and installing again will solve this? – Leosar Nov 25 '12 at 15:32
  • Not necessarily. Your problem is with something R depends upon. – Dirk Eddelbuettel Nov 25 '12 at 15:37
0

I had a similar problem, for me only starting R with sudo solved it.

esperluette
  • 1,792
  • 2
  • 14
  • 21