R lapack routines cannot be loaded

2019-06-26 06:30发布

问题:

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?

回答1:

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!



回答3:

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> 


回答4:

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