Skip to content

packages failed to load

17 messages · Carl Witthoft, Simon Urbanek, Tom Hopper +3 more

#
Just wanted to mention that I saw the same behavior with a package or 
two, and found the same workaround (copying libs to the 2.12 tree).

Carl

<quote>
Message: 4
Date: Tue, 24 May 2011 16:32:41 +1000
From: Ian Reeve <ireeve at une.edu.au>
To: "r-sig-mac at r-project.org" <r-sig-mac at r-project.org>
Subject: [R-SIG-Mac] Packages deldir,	class and gpclib fail to load in
	R 2.13.0
Message-ID: <23292B0B-0329-454C-9A17-5BB1CCB45337 at une.edu.au>
Content-Type: text/plain; charset="us-ascii"

Hi,

I've been running rgdal, RColorBrewer, maptools, classInt, spdep, 
gpclib, raster, zoo, cluster and lattice in R2.12 on Mac OSX 10.6.7 for 
the last 6 months with no problems.  Today I installed R 2.13.0, and 
downloaded the latest versions of the above packages.  Most of them load 
without problems, but class (a depend of classInt), and deldir (a depend 
of spdep) failed to load.  The error message is of the form:

-------------------------------
Loading required package: class
Error in dyn.load(file, DLLpath = DLLpath, ...) :
   unable to load shared object 
'/Library/Frameworks/R.framework/Versions/2.13/Resources/library/class/libs/x86_64/class.so':
 
dlopen(/Library/Frameworks/R.framework/Versions/2.13/Resources/library/class/libs/x86_64/class.so, 
6): Library not loaded: 
/Library/Frameworks/R.framework/Versions/2.12/Resources/lib/libR.dylib
   Referenced from: 
/Library/Frameworks/R.framework/Versions/2.13/Resources/library/class/libs/x86_64/class.so
   Reason: image not found
Error: package 'class' could not be loaded
-------------------------------

The problem seems to be either the package is looking in the wrong place 
(a subdirectory of 2.12 instead of a subdirectory of 2.13) for the file 
libR.dylib, or the install of R failed to put the files that package 
class needs in the 2.12 directory.  In the case of deldir, the errant 
file is libgfortran.2.dylib.

I can get  package class to load without error by taking a copy of 
libR.dylib from the subdirectory of 2.13 and putting it in the 
subdirectory of 2.12 where class  expects it to be.

I'm concerned this might be a stupid short-term fix, as calls to the 
functions in class might also fail due to other files not being in the 
expected places.

Can anyone suggest any leads to other approaches I could take to get 
these previously trouble-free packages to behave themselves in R 2.13?

Thank you.

Ian Reeve

Institute for Rural Futures
University of New England
Armidale, NSW 2351
#
On Tue, 24 May 2011, Carl Witthoft wrote:

            
Maybe, but this is about the recommended package 'class'.  In the CRAN 
distribution oF R 2.13.0

tystie% otool -L 
/Library/Frameworks/R.framework/Versions/2.13/Resources/library/class/libs/x86_64/class.so
/Library/Frameworks/R.framework/Versions/2.13/Resources/library/class/libs/x86_64/class.so:
 	class.so (compatibility version 0.0.0, current version 0.0.0)

/Library/Frameworks/R.framework/Versions/2.13/Resources/lib/libR.dylib 
(compatibility version 2.13.0, current version 2.13.0)

/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 
(compatibility version 150.0.0, current version 476.19.0)
 	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, 
current version 1.0.0)
 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, 
current version 111.1.5)

So class.so is linked to the correct libR.dylib.

Something odd has happened on Ian Reeve's system, and I suspect that a 
binary copy of 'class' built for R 2.12.x has been installed into 
2.13.0.

I suggest at a minimum running

update.packages(checkBuilt=TRUE)

and if the problems persist a complete clear out and re-install.

  
    
#
Ian,
I agree with Brian. I checked the CRAN binaries of class and deldir and they are correctly linking to 2.13, so I suspect you have old packages in your tree. I don't think this can happen with stock R binary, it seems that at some point you moved packages or there is/was a symlink between some libraries of 2.12 and 2.13. If the latter is true, to avoid future issues I would suggest 
sudo rm -rf /Library/Frameworks/R.framework
and re-installing R.

Cheers,
Simon
On May 24, 2011, at 9:48 AM, Prof Brian Ripley wrote:

            
#
Thanks Brian and Simon for the suggestions.

update.packages(checkBuilt=TRUE)

fixed the load problem and all the functions I was using in R 2.12 are running identically in R 2.13.0.

For future reference, when I update to a new version of R, is it good practice to:

sudo rm -rf /Library/Frameworks/R.framework

and then download and install the contributed packages one needs?  Otherwise, does the installing process for the base R package look at what is already there in R.framework tree and retain the contributed packages that were installed under the previous version?

Thanks Brian, Carl and Simon for your prompt assistance - it's very much appreciated.

Regards
Ian
On 24/05/2011, at 11:48 PM, Prof Brian Ripley wrote:

            
Ian Reeve
Institute for Rural Futures
University of New England
Armidale, NSW 2351

02 67735145
#
On May 24, 2011, at 7:32 PM, Ian Reeve wrote:

            
Usually, it is not needed. Just your setup seemed very unusual so it asked for radical measures ;) (libraries are separate for each major version so what you encountered does not happen in the default R setup).
Normally you just install new R and then use Package Manager to install packages to match your previous version. If you blow away old R, you will have no track of packages you installed before.

Cheers,
Simon
#
Well, that's a bit convoluted way (I really don't see the point of that "script") - if you want to re-install packages across R versions (not the topic of this thread!) it is far easier than that and I posted it here just a few days ago:

# for packages from user location:
install.packages(row.names(installed.packages("~/Library/R/2.12/library")))

# for packages from system location:
install.packages(row.names(installed.packages("/Library/Frameworks/R.framework/Versions/2.12/Resources/library")))

but as I said, the Package Manager gives you the latter without the need to type anything ...

Cheers,
Simon
On May 24, 2011, at 11:07 PM, Tom Hopper wrote:

            
#
It's really odd that people blog about their own inefficient scripts 
rather than read the R documentation.

Because this scripts checks (very inefficiently) if a package is 
already installed, it would not solve the problem discussed in this 
thread.  And install.packages() takes a vector of packages, and 
'survival' is a recommended package and should always be installed.

Because people have differing needs there are different ways to do 
this.  But the ideas of

http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f

suit many.
On Wed, 25 May 2011, Tom Hopper wrote:

            

  
    
#
On 25/05/2011, at 12:19 PM, Simon Urbanek wrote:

            
I've been in the habit of keeping all the .tgz files in a directory and using that as a guide for installing packages in the new R.  So I'm happy to trash the old R.

Thanks
Ian

Ian Reeve
Institute for Rural Futures
University of New England
Armidale, NSW 2351

02 67735145
#
On Wed, 25 May 2011, Tom Hopper wrote:

            
No, because it checks if they are already installed *as I said*.

  
    
#
On May 25, 2011, at 7:17 AM, Tom Hopper wrote:

            
No, you got it completely backwards! The script you referred to is useless in that case (and I told you that you are entirely off topic with that!), it has nothing to do with R. There is no "bug" in R mentioned anywhere in the thread, so you are really inventing things here. Please *do* read the e-mails you are receiving.

Thanks,
Simon
#
On Wed, May 25, 2011 at 9:52 AM, Tom Hopper <tomhopper at gmail.com> wrote:
You should not.

Sean