contrib.url in non-interactive mode

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

contrib.url in non-interactive mode

Renaud Gaujoux
Hi,

is it intended that one cannot install packages in non-interactive mode,
without explicitly setting a CRAN mirror (see below)?
Couldn't a default mirror be used in that case?
Thank you.

Bests,
Renaud

$ Rscript --vanilla -e "install.packages('whatever')"
Installing package into '/home/renaud/R/x86_64-pc-linux-gnu-library/3.0'
(as 'lib' is unspecified)
Error in contrib.url(repos, type) :
  trying to use CRAN without setting a mirror
Calls: install.packages -> grep -> contrib.url
Execution halted

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: contrib.url in non-interactive mode

Prof Brian Ripley
On 14/02/2014 10:03, Renaud Gaujoux wrote:
> Hi,
>
> is it intended that one cannot install packages in non-interactive mode,
> without explicitly setting a CRAN mirror (see below)?
> Couldn't a default mirror be used in that case?
> Thank you.

You seem to be talking about installing from CRAN.  The intention is
indeed that in non-interactive use you have to select the repositories
you want to use.  See ?setRepositories and its links.

It is up to you to set a default mirror: we have little idea where you
live (and it may not be where your email address suggests).  Geolocation
of mirrors had been mooted but not implemented (and in a corporate
setting is not 100% reliable).  The whole point of mirrors is to spread
the load: without them there would be no CRAN as the main host would not
allow the traffic.

This would have been appropriate for R-help, if it would not have been
answered by doing the homework required by the posting guide (which also
requires no HTML ...).

>
> Bests,
> Renaud
>
> $ Rscript --vanilla -e "install.packages('whatever')"
> Installing package into '/home/renaud/R/x86_64-pc-linux-gnu-library/3.0'
> (as 'lib' is unspecified)
> Error in contrib.url(repos, type) :
>    trying to use CRAN without setting a mirror
> Calls: install.packages -> grep -> contrib.url
> Execution halted
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: contrib.url in non-interactive mode

barry rowlingson
In reply to this post by Renaud Gaujoux
On Fri, Feb 14, 2014 at 10:54 AM, Prof Brian Ripley
<[hidden email]>wrote:

>
> It is up to you to set a default mirror: we have little idea where you
> live (and it may not be where your email address suggests).  Geolocation
> of mirrors had been mooted but not implemented (and in a corporate
> setting is not 100% reliable).  The whole point of mirrors is to spread
> the load: without them there would be no CRAN as the main host would not
> allow the traffic.
>
>
The RStudio CRAN mirror uses Amazon's CDN to achieve a degree of geographic
convenience:

http://blog.rstudio.org/2013/06/10/rstudio-cran-mirror/

 As far as I know all the other CRAN mirrors are geographically nailed down
and your data will come out of that server in that data centre wherever you
and it may be.

Barry

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: contrib.url in non-interactive mode

Dirk Eddelbuettel
In reply to this post by Renaud Gaujoux

Renaud,

The script below has been in use for about as long as littler existed, and
also ships with it. I use it, and its sibbling 'update.r' all the time. Doing
this at the command-line frees the R prompt during compilations too...

As Barry suggests, the RStudio-provided CDN is not a bad choice either as a
repo.

Dirk

edd@max:~$ cat bin/install.r
#!/usr/bin/env r
#
# a simple example to install one or more packages

if (is.null(argv) | length(argv)<1) {

  cat("Usage: installr.r pkg1 [pkg2 pkg3 ...]\n")
  q()

}

## adjust as necessary, see help('download.packages')
#repos <- "http://cran.us.r-project.org"
repos <- "http://cran.r-project.org"

## this makes sense on Debian where no packages touch /usr/local
lib.loc <- "/usr/local/lib/R/site-library"

install.packages(argv, lib.loc, repos)
edd@max:~$

--
Dirk Eddelbuettel | [hidden email] | http://dirk.eddelbuettel.com

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: contrib.url in non-interactive mode

hadley wickham
In reply to this post by barry rowlingson
>> It is up to you to set a default mirror: we have little idea where you
>> live (and it may not be where your email address suggests).  Geolocation
>> of mirrors had been mooted but not implemented (and in a corporate
>> setting is not 100% reliable).  The whole point of mirrors is to spread
>> the load: without them there would be no CRAN as the main host would not
>> allow the traffic.
>>
>>
> The RStudio CRAN mirror uses Amazon's CDN to achieve a degree of geographic
> convenience:
>
> http://blog.rstudio.org/2013/06/10/rstudio-cran-mirror/

Cloudfront, the service we use, currently has 36 locations around the
world: http://aws.amazon.com/cloudfront/details/.

Hadley

--
http://had.co.nz/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel