rstudio / rstudio/packrat

packrat mode is not being activated after cloning and packrat::restart()

Open
#539 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
409
Forks
89
PR merge metrics
No merged PRs in 30d

Description

Hi

I have Rstudio projects that are under packrat control with private libraries. When I clone these projects from Github in RStudio, packrat is being installed and the R session restarted, however packrat mode seems not to be turned on. I then have to run packrat::restore() and manually restart the R session to activate packrat mode.

I made an example https://github.com/burlab/packrat_restore_test which also shows this behaviour on all systems (Win and OSX) systems tested. The same behavour also occured when using the current development version of packrat.

Is there something I am missing out to automatically activate packrat mode after cloning or opening the R project that has been under packrat control, but with no installed packages?

Thank you for your time!

Packrat is not installed in the local library -- attempting to bootstrap an installation...
> Installing packrat into project private library:
- "packrat/lib/x86_64-w64-mingw32/3.5.2"
* installing *source* package 'packrat' ...
** package 'packrat' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'packrat'
    finding HTML links ... done
    appDependencies                         html  
    bitbucket_pwd                           html  
    bitbucket_user                          html  
    bundle                                  html  
    clean                                   html  
    disable                                 html  
    init                                    html  
    install                                 html  
    install_local                           html  
    lockfile-metadata                       html  
Rd warning: C:/Users/bobur/AppData/Local/Temp/RtmpucCyb9/R.INSTALL61b0260b5340/packrat/man/lockfile-metadata.Rd:18: file link 'package_version' in package 'base' does not exist and so has been treated as a topic
    packify                                 html  
    packrat-external                        html  
    packrat-mode                            html  
    packrat-options                         html  
    packrat-resources                       html  
    packrat                                 html  
    repos_create                            html  
    repos_upload                            html  
    repository-management                   html  
    restore                                 html  
    search_path                             html  
    snapshot                                html  
    snapshotImpl                            html  
    status                                  html  
    unbundle                                html  
    unused_packages                         html  
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (packrat)
In R CMD INSTALL
> Attaching packrat
> Restoring library
> Packrat bootstrap successfully completed. Restarting R and entering packrat mode...

Restarting R session...

> 

Manually restoring packages with packrat:restore()

> packrat::restore(restart = TRUE)
Installing GlobalOptions (0.1.0) ... 
	OK (downloaded binary)
Installing RColorBrewer (1.1-2) ... 
	OK (downloaded binary)
Installing Rcpp (1.0.0) ... 
	OK (downloaded binary)
Installing base64enc (0.1-3) ... 
	OK (downloaded binary)
Installing colorspace (1.4-0) ... 
	OK (downloaded binary)
Installing digest (0.6.18) ... 
	OK (downloaded binary)
Installing evaluate (0.12) ... 
	OK (built source)
Installing glue (1.3.0) ... 
	OK (downloaded binary)
Installing highr (0.7) ... 
	OK (downloaded binary)
Installing jsonlite (1.6) ... 
	OK (downloaded binary)
Installing magrittr (1.5) ... 
	OK (downloaded binary)
Installing mime (0.6) ... 
	OK (downloaded binary)
Installing rjson (0.2.20) ... 
	OK (downloaded binary)
Installing shape (1.4.4) ... 
	OK (downloaded binary)
Installing stringi (1.2.4) ... 
	OK (built source)
Installing xfun (0.4) ... 
	OK (downloaded binary)
Installing yaml (2.2.0) ... 
	OK (downloaded binary)
Installing htmltools (0.3.6) ... 
	OK (downloaded binary)
Installing markdown (0.9) ... 
	OK (downloaded binary)
Installing GetoptLong (0.1.7) ... 
	OK (downloaded binary)
Installing circlize (0.4.5) ... 
	OK (downloaded binary)
Installing stringr (1.4.0) ... 
	OK (downloaded binary)
Installing tinytex (0.10) ... 
	OK (downloaded binary)
Installing ComplexHeatmap (1.99.4) ... 
	OK (built source)
Installing knitr (1.21) ... 
	OK (downloaded binary)
Installing rmarkdown (1.11) ... 
	OK (downloaded binary)
> 

SessionInfo after manually restarting R and running the R notebook in folder /analysis

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] circlize_0.4.5        ComplexHeatmap_1.99.4

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0          packrat_0.5.0       digest_0.6.18       jsonlite_1.6        magrittr_1.5        evaluate_0.12       GlobalOptions_0.1.0 stringi_1.2.4       GetoptLong_0.1.7    rmarkdown_1.11     
[11] RColorBrewer_1.1-2  rjson_0.2.20        tools_3.5.2         stringr_1.4.0       xfun_0.4            yaml_2.2.0          compiler_3.5.2      colorspace_1.4-0    base64enc_0.1-3     shape_1.4.4        
[21] htmltools_0.3.6     knitr_1.21   

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked packrat_restore_test reproduction and the bootstrap output showing packrat installation, restoration, and restart after cloning in RStudio. Compare that behavior with packrat::restore(restart = TRUE) and verify the result on the reported Windows and macOS setups. Done means a cloned or opened project automatically enters packrat mode without a manual restore and restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.