Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install_github() not installing contents of 'inst' folder #161

Closed
profandyfield opened this issue Sep 18, 2018 · 12 comments
Closed

install_github() not installing contents of 'inst' folder #161

profandyfield opened this issue Sep 18, 2018 · 12 comments

Comments

@profandyfield
Copy link

I have a package of r tutorials written in learnr (adventr) that I deploy through github.
In case you're not familiar with learnr, each tutorial sits in its own folder within a folder called tutorials in the 'inst' folder of the package. For example, the tutorial called 'adventr_01' sits in inst > tutorials > adventr_01

When you install, the tutorials folder should be installed within the top level of the package (as with any folder within inst). This is what happens using install_github("profandyfield/adventr") on my personal mac and laptop (and indeed others who I know use then package). However, I recently stumbled across an issue when trying to install this package on my university teaching computers (Windows 10). These computers have a desktop install of RStudio, but packages are installed in the user directory, not the usual C:/PROGRA~1/R/..... directory. For example, here's what I get when I try to install my package using install_github:

`

install_github("profandyfield/adventr")
Downloading GitHub repo profandyfield/adventr@master
from URL https://api.github.com/repos/profandyfield/adventr/zipball/master
Installing adventr
"C:/PROGRA1/R/R-351.0/bin/x64/R" --no-site-file
--no-environ --no-save --no-restore --quiet CMD INSTALL
"C:/Users/andyf/AppData/Local/Temp/RtmpS6jYMY/devtools206c7ba031a6/profandyfield-adventr-ed315c1"
--library="\its-home.uscs.susx.ac.uk/home/andyf/Documents/R/win-library/3.5"
`

None of the above seems odd, and that's what happens when packages are installed from CRAN. When I look in Documents/R/win-library/3.5 I see a folder with my adventr package as expected BUT the contents of the inst folder are not there. In other words, the install appears fine at face value except that there is no tutorials folder in the package folder - the contents of 'inst' have not been copied to Documents/R/win-library/3.5/adventr as they should be.

When I try to run a tutorial I get an error that it doesn't exist (obviously, because it doesn't). it seems to me it might be a problem resulting from the library being created in a location other than the default. Is this a remotes issue or a me being stupid issue? Is there any obvious reason why the 'inst' folder is being ignored at install? Apologies if this is a dumb question - I'm fairly new to packages and stuff ... Thanks very much for any suggestions you have.

@gaborcsardi
Copy link
Member

I cannot reproduce this. I would try removing the package folder and running the installation again. After it is done you can use system.file(package = "adventr") to see the directory of the installed package, and dir(system.file(package = "adventr")) to see the files in the package directory. This contains tutorials for me.

@profandyfield
Copy link
Author

Thanks for getting back to me. I've done the above, and it still installs but without the tutorials folder. Here's the full install message:

> remotes::install_github("profandyfield/adventr")
Downloading GitHub repo profandyfield/adventr@master
Installing 1 packages: reprex
package ‘reprex’ successfully unpacked and MD5 sums checked
Installing package into ‘\\its-home.uscs.susx.ac.uk/home/andyf/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
'\\its-home.uscs.susx.ac.uk\home\andyf\Documents'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
* installing *source* package 'adventr' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Warning: package 'learnr' was built under R version 3.5.1
Warning: package 'tidyverse' was built under R version 3.5.1
Warning: package 'ggplot2' was built under R version 3.5.1
Warning: package 'tibble' was built under R version 3.5.1
Warning: package 'tidyr' was built under R version 3.5.1
Warning: package 'readr' was built under R version 3.5.1
Warning: package 'purrr' was built under R version 3.5.1
Warning: package 'dplyr' was built under R version 3.5.1
Warning: package 'stringr' was built under R version 3.5.1
Warning: package 'forcats' was built under R version 3.5.1
** help
*** installing help indices
  converting help for package 'adventr'
    finding HTML links ... done
    adventr                                 html  
    alice_dat                               html  
    calcite_dat                             html  
    garlic_dat                              html  
    ha_dat                                  html  
    implant_dat                             html  
    jig_dat                                 html  
    mask_dat                                html  
    mem_cov_dat                             html  
    memory_dat                              html  
    ras_dat                                 html  
    recovery_dat                            html  
    rehab_dat                               html  
    rehab_growth_dat                        html  
    taser_dat                               html  
    teddy_dat                               html  
    zhang_female_dat                        html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Warning: package 'learnr' was built under R version 3.5.1
Warning: package 'tidyverse' was built under R version 3.5.1
Warning: package 'ggplot2' was built under R version 3.5.1
Warning: package 'tibble' was built under R version 3.5.1
Warning: package 'tidyr' was built under R version 3.5.1
Warning: package 'readr' was built under R version 3.5.1
Warning: package 'purrr' was built under R version 3.5.1
Warning: package 'dplyr' was built under R version 3.5.1
Warning: package 'stringr' was built under R version 3.5.1
Warning: package 'forcats' was built under R version 3.5.1
*** arch - x64
Warning: package 'learnr' was built under R version 3.5.1
Warning: package 'tidyverse' was built under R version 3.5.1
Warning: package 'ggplot2' was built under R version 3.5.1
Warning: package 'tibble' was built under R version 3.5.1
Warning: package 'tidyr' was built under R version 3.5.1
Warning: package 'readr' was built under R version 3.5.1
Warning: package 'purrr' was built under R version 3.5.1
Warning: package 'dplyr' was built under R version 3.5.1
Warning: package 'stringr' was built under R version 3.5.1
Warning: package 'forcats' was built under R version 3.5.1
* DONE (adventr)
In R CMD INSTALL

Our university desktop install is running R 3.5.0 (hence the warnings) but otherwise it looks fine. The package is found where it is supposed to be:

> system.file(package = "adventr")
[1] "\\\\its-home.uscs.susx.ac.uk/home/andyf/Documents/R/win-library/3.5/adventr"

but the tutorial folder is missing:

> dir(system.file(package = "adventr"))
[1] "data"        "DESCRIPTION" "help"        "html"       
[5] "INDEX"       "Meta"        "NAMESPACE"   "R"     

I will check again with our ITS people to see whether there's any reason at this end why that folder would be prevented from installing. I realise if you can't reproduce the error it's almost impossible for you to suggest anything, but if you have any further thoughts I'd be grateful.

@gaborcsardi
Copy link
Member

I am afraid that this fails because of the UNC path, and this is actually an install.packages() issue, remotes just calls that for the actual installation.

Also, what version of remotes is this? Can you please try the current GitHub version, just in case it is not caused by the UNC path, but something else.

@profandyfield
Copy link
Author

Thanks. I've just tried with the GitHub release of remotes, same problem. Is there a workaround for the UNC path issue that you know of or could point me towards?

@gaborcsardi
Copy link
Member

@profandyfield
Copy link
Author

Thanks - I've found some related stuff by searching, and it looks like the issue was raised here too. I'll talk to our system admins and hope they have a solution! Thanks so much for your help - knowing what the problem is is a huge step forwards. Thank you.

@gaborcsardi
Copy link
Member

Well, I am not sure it is the UNC path, maybe.

@profandyfield
Copy link
Author

Just to close the loop on this, turns out the network share is already mapped, and adventr installs correctly by specifying the lib explicitly:

remotes::install_github("profandyfield/adventr", lib = "N:/Documents/R/win-library/3.5")

phew. Thanks again - I'm really grateful.

@gaborcsardi
Copy link
Member

gaborcsardi commented Sep 19, 2018

Great, thanks for letting me know! It is good to know about this issue, we'll see if we can fix it in r-lib/pkginstall. Since it will not be fixed in remotes, I'll close this issue now.

@stemangiola
Copy link

Sorry to pick this back up, but I also have the same problem years later and seemingly for an unrelated reason. I was just wondering whether anyone had more insights since then.

devtools::install_github("MangiolaLaboratory/sccomp", force=T)

does not transfer the inst directory.

@gaborcsardi
Copy link
Member

@stemangiola It does for me:

❯ devtools::install_github("MangiolaLaboratory/sccomp", force=T)
[...]
Installing package into ‘/Users/gaborcsardi/Library/R/arm64/4.4/library’
(as ‘lib’ is unspecified)
[...]
** inst
[...]
* DONE (sccomp)
❯ dir(find.package("sccomp"))
 [1] "cartoon_methods.png" "CITATION"            "data"
 [4] "DESCRIPTION"         "figures"             "help"
 [7] "html"                "INDEX"               "LICENSE"
[10] "logo-01.png"         "Meta"                "NAMESPACE"
[13] "NEWS.rd"             "R"                   "stan"

@stemangiola
Copy link

Yes sorry, I just fixed it. The commit before fix

remotes::install_github("MangiolaLaboratory/sccomp@63160d230d10089d5316c5023d11c54e2d7cc74b", force=T)

it would not. Sorry to generate confusion.

My problem was the addition of files in the .Rbuildignore without setting the end-of-string character, so it was capturing too many files, and inst was ignored as "empty"

checking for empty or unneeded directories
   Removed empty directorysccomp/inst/stan’
─  buildingsccomp_1.99.9.tar.gz

@r-lib r-lib locked as resolved and limited conversation to collaborators Jan 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants