Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-09 Thread Uwe Ligges



On 08.02.2012 21:05, Hadley Wickham wrote:

2012/2/8 Uwe Liggeslig...@statistik.tu-dortmund.de:



On 08.02.2012 19:36, Hadley Wickham wrote:


I wonder it works that far. It won't for me on Windows nor Linux, because
system2 passes the whole thing shQuoted to the shell. Hence it is highly
shell dependent what happens with the ill formed command.



Well I was using the env argument to system2, which claims to be
cross-platform (at least for R and make).  This command:

R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/

is ok, isn't it?



You haven't said you were using the env argument, have you? If so, I missed
that part. I assumed you were specifying the above as the command
argument.

Hmmm, former message not quoted, as we ask in the posting guide. Where is
the reproducible example?


We seem to be having a bit of a communication breakdown.  This is the
code that I run from the command line (on mac os x):

R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
# Desktop : R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
# * installing to library ‘/Users/hadley/R’
# ERROR: dependency ‘ascii’ is not available for package ‘rapport’

But:

ls /Users/hadley/R-dev/
# HandyStuff animation  biOps  mcmcTools  mvbutils   quantreg   testthat
# SparseMascii  ggplot2mturkr nstest scales whisker

It's hard to provide a reproducible example because it depends on
exactly what package you have installed where, but I had hoped that
this would at least illustrate my problem - R CMD install doesn't seem
to be respecting R_LIBS.  I'm trying to understand whether this is a
bug, or something I don't understand correctly about R CMD INSTALL.


That's right, then you want (under Linux alikes):

system2(R, CMD INSTALL package_version.tar.gz, env=R_LIBS=lib)

obviously.

Under Windows, you have to construct the shell command:

set R_LIBS=lib  R CMD INSTALL package_version.tar.gz


To clarify, system2 doesn't work in windows?


It does.

 The system2

documentation has:  On Windows, ‘env’ is currently only supported for
commands such as ‘R’ and ‘make’ which accept environment variables on
their command line.


Yes, but R CMD INSTALL does not accept those variables in the command 
line. This could perhaps be improved given someone finds some time to do it.


Uwe




Hadley



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-09 Thread Hadley Wickham

 To clarify, system2 doesn't work in windows?

 It does.

 The system2

 documentation has:  On Windows, ‘env’ is currently only supported for
 commands such as ‘R’ and ‘make’ which accept environment variables on
 their command line.

 Yes, but R CMD INSTALL does not accept those variables in the command
 line. This could perhaps be improved given someone finds some time to do it.

Ok, so R does, but R CMD INSTALL does not.  That was the source of my
confusion - thanks for clearing that up!

However, is there a reason that system2 doesn't use the more general
technique of Sys.setenv?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-08 Thread Uwe Ligges



On 07.02.2012 19:13, Hadley Wickham wrote:

Hi all,

Am I using the correct syntax to set a custom R_LIBS when running R
CMD INSTALL from the command line?

I get:

R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
# Desktop : R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
# * installing to library ‘/Users/hadley/R’
# ERROR: dependency ‘ascii’ is not available for package ‘rapport’



I wonder it works that far. It won't for me on Windows nor Linux, 
because system2 passes the whole thing shQuoted to the shell. Hence it 
is highly shell dependent what happens with the ill formed command.


Whay not specify --library= in R CMD INSTALL if you are calling it 
programatically from R anyway?


Uwe


But:

ls /Users/hadley/R-dev/
# HandyStuff animation  biOps  mcmcTools  mvbutils   quantreg   testthat
# SparseMascii  ggplot2mturkr nstest scales whisker

(I'm actually running this from inside R using system2, but I think
this is the essence of my misunderstanding)

Hadley



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-08 Thread Hadley Wickham
 I wonder it works that far. It won't for me on Windows nor Linux, because
 system2 passes the whole thing shQuoted to the shell. Hence it is highly
 shell dependent what happens with the ill formed command.

Well I was using the env argument to system2, which claims to be
cross-platform (at least for R and make).  This command:

R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/

is ok, isn't it?

 Whay not specify --library= in R CMD INSTALL if you are calling it
 programatically from R anyway?

My understanding (from reading R CMD INSTALL --help) was that
--library was for specifying the destination library.  Here I want to
specify the full libpath - i.e. some of the packages that this package
depends on may be in library 1, others may be in library 2.  Have I
misunderstood the documentation?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-08 Thread Dirk Eddelbuettel

On 8 February 2012 at 19:26, Uwe Ligges wrote:
| 
| 
| On 07.02.2012 19:13, Hadley Wickham wrote:
|  Hi all,
| 
|  Am I using the correct syntax to set a custom R_LIBS when running R
|  CMD INSTALL from the command line?
| 
|  I get:
| 
|  R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
|  # Desktop : R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
|  # * installing to library ‘/Users/hadley/R’
|  # ERROR: dependency ‘ascii’ is not available for package ‘rapport’
| 
| 
| I wonder it works that far. It won't for me on Windows nor Linux, 
| because system2 passes the whole thing shQuoted to the shell. Hence it 
| is highly shell dependent what happens with the ill formed command.
| 
| Whay not specify --library= in R CMD INSTALL if you are calling it 
| programatically from R anyway?

AFAICT Hadley is concerned about a library _source_ directory (for something
the package under development needs to run / load) rather than a _destination_.

Dirk
 
| Uwe
| 
|  But:
| 
|  ls /Users/hadley/R-dev/
|  # HandyStuff animation  biOps  mcmcTools  mvbutils   quantreg   testthat
|  # SparseMascii  ggplot2mturkr nstest scales whisker
| 
|  (I'm actually running this from inside R using system2, but I think
|  this is the essence of my misunderstanding)
| 
|  Hadley
| 
| 
| __
| R-devel@r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read. -- Groucho Marx

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-08 Thread Uwe Ligges



On 08.02.2012 19:36, Hadley Wickham wrote:

I wonder it works that far. It won't for me on Windows nor Linux, because
system2 passes the whole thing shQuoted to the shell. Hence it is highly
shell dependent what happens with the ill formed command.


Well I was using the env argument to system2, which claims to be
cross-platform (at least for R and make).  This command:

R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/

is ok, isn't it?


You haven't said you were using the env argument, have you? If so, I 
missed that part. I assumed you were specifying the above as the 
command argument.


Hmmm, former message not quoted, as we ask in the posting guide. Where 
is the reproducible example?


Anyway, this won't work under a Windows shell, I believe. At least, I do 
not know how to set an env variable and run RCMD INSTALL in a Windows 
shell as a one liner - independent of R.




Whay not specify --library= in R CMD INSTALL if you are calling it
programatically from R anyway?


My understanding (from reading R CMD INSTALL --help) was that
--library was for specifying the destination library.  Here I want to
specify the full libpath - i.e. some of the packages that this package
depends on may be in library 1, others may be in library 2.  Have I
misunderstood the documentation?


That's right, then you want (under Linux alikes):

system2(R, CMD INSTALL package_version.tar.gz, env=R_LIBS=lib)

obviously.

Under Windows, you have to construct the shell command:

set R_LIBS=lib  R CMD INSTALL package_version.tar.gz

Uwe









Hadley



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-08 Thread Dirk Eddelbuettel

On 8 February 2012 at 20:05, Uwe Ligges wrote:
| Anyway, this won't work under a Windows shell, I believe. At least, I do 
| not know how to set an env variable and run RCMD INSTALL in a Windows 
| shell as a one liner - independent of R.

FWIW this issue was addressed by Oleg years ago in cfunction() in his inline
package -- by using Sys.setenv() prior to calling system().  This works
in a cross-platform way, avoiding the need for special cases.

Dirk

-- 
Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read. -- Groucho Marx

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-08 Thread Hadley Wickham
2012/2/8 Uwe Ligges lig...@statistik.tu-dortmund.de:


 On 08.02.2012 19:36, Hadley Wickham wrote:

 I wonder it works that far. It won't for me on Windows nor Linux, because
 system2 passes the whole thing shQuoted to the shell. Hence it is highly
 shell dependent what happens with the ill formed command.


 Well I was using the env argument to system2, which claims to be
 cross-platform (at least for R and make).  This command:

 R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/

 is ok, isn't it?


 You haven't said you were using the env argument, have you? If so, I missed
 that part. I assumed you were specifying the above as the command
 argument.

 Hmmm, former message not quoted, as we ask in the posting guide. Where is
 the reproducible example?

We seem to be having a bit of a communication breakdown.  This is the
code that I run from the command line (on mac os x):

R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
# Desktop : R_LIBS=/Users/hadley/R-dev R CMD INSTALL aL3xa-rapport-08e68ca/
# * installing to library ‘/Users/hadley/R’
# ERROR: dependency ‘ascii’ is not available for package ‘rapport’

But:

ls /Users/hadley/R-dev/
# HandyStuff animation  biOps  mcmcTools  mvbutils   quantreg   testthat
# SparseMascii  ggplot2mturkr nstest scales whisker

It's hard to provide a reproducible example because it depends on
exactly what package you have installed where, but I had hoped that
this would at least illustrate my problem - R CMD install doesn't seem
to be respecting R_LIBS.  I'm trying to understand whether this is a
bug, or something I don't understand correctly about R CMD INSTALL.

 That's right, then you want (under Linux alikes):

 system2(R, CMD INSTALL package_version.tar.gz, env=R_LIBS=lib)

 obviously.

 Under Windows, you have to construct the shell command:

 set R_LIBS=lib  R CMD INSTALL package_version.tar.gz

To clarify, system2 doesn't work in windows?  The system2
documentation has:  On Windows, ‘env’ is currently only supported for
commands such as ‘R’ and ‘make’ which accept environment variables on
their command line.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using custom R_LIBS with R CMD install

2012-02-08 Thread Hadley Wickham
 It's hard to provide a reproducible example because it depends on
 exactly what package you have installed where, but I had hoped that
 this would at least illustrate my problem - R CMD install doesn't seem
 to be respecting R_LIBS.  I'm trying to understand whether this is a
 bug, or something I don't understand correctly about R CMD INSTALL.

Ok - found the problem.  I had

R_LIBS=~/R

in my .Renviron

which overrides the environment variable.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel