Devtools: install_github having trouble with my local libraries

Created on 8 Oct 2013  Â·  25Comments  Â·  Source: r-lib/devtools

Hi, I'm trying to install the 'rga' pacakge but I'm having no luck. I'm getting an issue with packages not being found in the local libraries.

Here's my input/output

install_github("rga", "skardhamar")
Installing github repo(s) rga/master from skardhamar
Downloading rga.zip from https://github.com/skardhamar/rga/archive/master.zip
Installing package from C:\Users\SIMON~1.HAY\AppData\Local\Temp\RtmpAX3mWl/rga.zip
Installing rga
"C:/PROGRA~1/R/R-30~1.1/bin/x64/R" --vanilla CMD INSTALL  \
  "C:\Users\simon.hayward\AppData\Local\Temp\RtmpAX3mWl\rga-master"  \
  --library="\\.../personal/.../simon.hayward/Documents/R/win-library/3.0"  \
  --with-keep.source --install-tests 

* installing *source* package 'rga' ...
** R
** preparing package for lazy loading
Warning: package 'lubridate' was built under R version 3.0.2
Warning: package 'httr' was built under R version 3.0.2
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
  there is no package called 'rga'
Error: loading failed
Execution halted
ERROR: loading failed
* removing '\\.../personal/.../simon.hayward/Documents/R/win-library/3.0/rga'
* restoring previous '\\.../personal/.../simon.hayward/Documents/R/win-library/3.0/rga'
Error: Command failed (1)

Is the error due to the filepath format for my library ( at the beginning)? Is there a way to fix this? I don't understand why it is failing to find the rga.zip file in my library.
I have check that the library path is correct and open to my RStudio using .libPaths().

My R version is 3.0.1 and I have installed and found Rtools 3.0

Most helpful comment

Hi Simon,

How did you solve this problem? I have an identical problem when I was trying to install a package from github using install_github into a share disc.

All 25 comments

My apologies if this is a duplicate, I did check similar problems and didn't see this raised.

I've asked a question related to this on StackOverflow, http://stackoverflow.com/questions/19221520/error-when-installing-rga-package but as you can see the title is a bit off, because i thought it was a problem with 'rga' but I've found the same problems with the 'ganalytics' package too.

EDIT: And I get a similar error for the 'shiny' package. All seems to be going fine and the I get told that there is no package called 'shiny' is it possible that install_github doesn't have access to the relevant library paths? (from the output it seems to, but doesn't seem to find what it needs.....

Could you please give me the output of .libPaths()?

Sure thing

.libPaths()
[1] "\..../personal/..../simon.hayward/Documents/R/win-library/3.0"
[2] "C:/Program Files/R/R-3.0.1/library"

The ellipses are just there to hide some company specific stuff.

EDIT: Just realised github is hiding some of the backslashes at the beginning of the first path, there are four in the R output, so they should be escaped properly.

The exact form of the path is super important - can you please just replace each directory name with a random string?

.libPaths()
[1] "\\thiscompany.office/personal/userdata-Inthistown/simon.hayward/Documents/R/win-library/3.0"
[2] "C:/Program Files/R/R-3.0.1/library"

I've added extra backslashes at the beginning of the string so it now appears exactly as I see it in RStudio.

Thanks Hadley.

That's a network shared drive? How are you setting your lib paths?

Yes, the top one is shared. If I try to write to the local drive (by deleting the network drive as a libPath) I get

"Warning in install.packages(deps, dependencies = dependencies) :
'lib = "C:/Program Files/R/R-3.0.1/library"' is not writable"

So the shared drive library was set by default when I tried to install a package and it couldn't install on the C drive with R (if I recall correctly), so it created another library elsewhere. Maybe I need to speak to a sysadmin about getting write permission for the C: drive and that make allow the installation?

I don't know why install_github wouldn't just write to the library on the shared drive as install.packages has been doing, but then again I don't really know enough to fix this kind of issue when it arises.

I doubt the write permissions are the issue - I'm just trying to figure out what's going wrong.

Does install.packages() work?

Yes, here's me installing ggmap for example, just now

install.packages("ggmap")
Installing package into ‘\this.office/personal/UserData-thistown/simon.hayward/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/ggmap_2.3.zip'
Content type 'application/zip' length 4529269 bytes (4.3 Mb)
opened URL
downloaded 4.3 Mb

Odd that it tells me 'lib' is unspecified, yet .libPaths() gives me two paths to libraries.

Could you please try installing the latest devel version by downloading https://dl.dropboxusercontent.com/u/41902/devtools_1.3.99.zip and then installing from a local zip file from within R?

Managed it to install it ok on my home computer, which has a very similar stack. So must be that it can't write to the local library, and the shared network folder is a problem. Github has complained when I tried to use that for my repository before.

I will send the new version to myself at work (I'm at home now), to try tomorrow. Thanks for the continued help.

Still no luck on my work machine with version 1.3.99 of devtools, still the same error when I try to use install_github.

I did get the following warning when installing devtools

"Warning in install.packages :
package ‘//this.office/personal/UserData-thisTown/simon.hayward/Downloads/devtools_1.3.99.zip’ is not available (for R version 3.0.1)"

But it seems to have installed ok, and the version in my library on the network drive is 1.3.99 according to the decription file.

I'm going to ask the sys admins if I there's a way that I can have my R library on the C: drive, it seems a ludicrous restriction that R can't save packages there.

I'm now pretty sure that this is an issue with 1. The C drive and my needing admin privileges to write to it. I don't know how I would invoke those privileges within R or R studio. 2. So, R is using a local library on the network shared drive for my other packages, but I think github is sulking because of the \ at the beginning of the network drive filepath, so between the two issues, I'm unable to use install_github :(

Can you please confirm the output of .libPaths() has four slashes but the path printed out by install_github (after --library) only has two slashes?

And if so, could you try changing your .libPath() to use // and see if that works with devtools?

No joy, the error message states

Error in C("/this.office/personal/UserData-thistown/simon.hayward/Documents/R/win-library/3.0", :
object not interpretable as a factor

Again GitHub has eaten one of the forward slashes. Yes the R output has 4 backslashes in the first part of the .libPath() output.

Is there anyway for devtools to install from a local zip file? I've tried installing 'rga' from a local zip (using install.packages) but R tells me that it isn't a valid package, (since it is still under development).

Further: I need admin privileges to write to the C: drive on my computer. I've tried running RStudio as an admin but it still won't write to the C: drive. Is there anyway I could pass elevated privileges to install_github?

Right, I'm a fool.

I changed to .libPaths("//this.office/personal/UserData-thistown/simon.hayward/Documents/R/win-library/3.0") succesfully, but now my error message is as follows:-

  • installing _source_ package 'rga' ...
    * R
    ** preparing package for lazy loading
    ** help
    *
    * installing help indices
    * building package indices
    ** testing if installed package can be loaded
    *
    * arch - i386
    Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
    there is no package called 'rga'
    Error: loading failed
    Execution halted
    *** arch - x64
    Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
    there is no package called 'rga'
    Error: loading failed
    Execution halted
    ERROR: loading failed for 'i386', 'x64'
  • removing 'this.office/personal/UserData-thistown/simon.hayward/Documents/R/win-library/3.0/rga'
    Error: Command failed (1)

Which is at least different to what I had before! :)

The output of .libPaths() still has the 4 backslashes, although it seemed to change succesfully. Should have checked more carefully.

Another idea - can you bind that network address to a drive letter? Then try setting .libPaths() without any // or \\\\

Yes, that's a good idea, I'll have to speak to the senior sysadmin on Monday, rather than monkeying with registry entries!

Thanks Hadley you're a good man and thorough. Have a good weekend.

Yes! It worked! (Also it's easier now to map a drive to a letter than it used to be).

Thanks a bunch Professor!

Hi Simon,

How did you solve this problem? I have an identical problem when I was trying to install a package from github using install_github into a share disc.

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ctbrown picture ctbrown  Â·  4Comments

Mullefa picture Mullefa  Â·  6Comments

nick-youngblut picture nick-youngblut  Â·  6Comments

hadley picture hadley  Â·  6Comments

pssguy picture pssguy  Â·  5Comments