On 12-04-03 3:29 PM, Simon Urbanek wrote:

On Apr 3, 2012, at 3:09 PM, Berend Hasselman wrote:


On 03-04-2012, at 20:54, Duncan Murdoch wrote:

On 03/04/2012 1:04 PM, Berend Hasselman wrote:
On 03-04-2012, at 18:50, Duncan Murdoch wrote:

This is a message from R-help about installing a package in OSX.  The NAMESPACE 
file contains an error, but the user didn't see the error message when he 
installed from the Mac GUI.  Is R.app missing one of the output streams?  I see 
the following in the Windows Rgui:

install.packages("d:/temp/HelloWorld_1.0.tar.gz", type="source", repos=NULL)
* installing *source* package 'HelloWorld' ...
** R
** preparing package for lazy loading
** help
Warning: 
C:/Users/murdoch/AppData/Local/Temp/Rtmpm6LVhP/R.INSTALLc4762d6689/HelloWorld/man/HelloWorld-package.Rd:32:
 All text must be in a section
Warning: 
C:/Users/murdoch/AppData/Local/Temp/Rtmpm6LVhP/R.INSTALLc4762d6689/HelloWorld/man/HelloWorld-package.Rd:33:
 All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) : undefined exports: HelloWorld
Error: loading failed
Execution halted
ERROR: loading failed
* removing 'F:/R/svn/R-2-15-branch/library/HelloWorld'
Warning messages:
1: running command 'F:/R/svn/R-2-15-branch/bin/i386/R CMD INSTALL -l 
"F:/R/svn/R-2-15-branch/library"   "d:/temp/HelloWorld_1.0.tar.gz"' had status 1
2: In install.packages("d:/temp/HelloWorld_1.0.tar.gz", type = "source",  :
  installation of package ‘d:/temp/HelloWorld_1.0.tar.gz’ had non-zero exit 
status

I have tried this.
The package is installed without complaints in both R.app and an interactive R 
from the Terminal.

Installation only seems to fail with R CMD INSTALL.

Is it really installed, or are there just no error messages?  Marc was finding 
that library(HelloWorld) was failing, and he didn't understand why.


R GUI:
===============================
No messages. Installed.
library(HelloWorld) gives

library(HelloWorld)
Error in library(HelloWorld) :
  ‘HelloWorld’ is not a valid installed package


R CMD INSTALL:
===============================
gives an error message and does not install.
library(HelloWorld) gives

library(HelloWorld)
Error in library(HelloWorld) : there is no package called ‘HelloWorld’


Ah, now I got it -- this is a very nice user error, the GUI is entirely 
innocent here -- note that the default in install.packages() is *binary* 
installation and .tar.gz is the format of both source and binary packages on OS 
X, so R will happily treat the downloaded source package as binary so you don't 
get any output, because the package is simply unpacked and not compiled. 
However, that is not a valid package so you can't load it.

What the user intended was

install.packages("HelloWorld_1.0.tar.gz", repos = NULL, type='source')
* installing *source* package ‘HelloWorld’ ...
** R
** preparing package for lazy loading
** help
Warning: 
/private/var/folders/Sq/SqwOn3XRE7WB0ZmJXYRnfE+++TI/-Tmp-/RtmpxI4NuG/R.INSTALL144c53d879430/HelloWorld/man/HelloWorld-package.Rd:32:
 All text must be in a section
Warning: 
/private/var/folders/Sq/SqwOn3XRE7WB0ZmJXYRnfE+++TI/-Tmp-/RtmpxI4NuG/R.INSTALL144c53d879430/HelloWorld/man/HelloWorld-package.Rd:33:
 All text must be in a section
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) : undefined exports: HelloWorld
Error: loading failed
Execution halted
ERROR: loading failed
* removing 
‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/HelloWorld’
* restoring previous 
‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/HelloWorld’
Warning message:
In install.packages("HelloWorld_1.0.tar.gz", repos = NULL, type = "source") :
   installation of package ‘HelloWorld_1.0.tar.gz’ had non-zero exit status


which fails as it should ...

So the only thing here is that binary install should perhaps check the content 
and refuse to install source package as binary or something like that ... there 
is not such problem in Windows, because there the binaries use different format 
altogether (zip vs tgz).


Okay, that makes sense now.

One other possible change: install.packages() currently guesses "repos=NULL" based on the look of the package name: e.g. if type=="mac.binary" and the name matches "\\.tgz$", repos is set to NULL. Perhaps the type could also be guessed from the name if unspecified, and at least a message could be given if it doesn't match the default.

Duncan Murdoch

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to