rstudio / packrat

Packrat is a dependency management system for R
http://rstudio.github.io/packrat/
401 stars 89 forks source link

Project crashes if "Packrat" is activated (Fatal error 4) #274

Open GegznaV opened 8 years ago

GegznaV commented 8 years ago

I created a new RStudio project. It seemed to work fine until I activated the option to use the packrat package and a folder "packrat" was created in the project's directory as expected. Unfortunately, now RStudio crashes every time I try to open the project and the message of a fatal error appears:

R error

Before my attempt to open the project, "package:utils" can be found on the search list by using search().

If I delete the "pacrat" folder, RStudio works as usual and I can open the project without any message of fatal error, but without packrat.

I'd like to know what are the causes and what must be done to avoid this fatal error without losing functionality of packrat?

I run RStudio under Windows 10:

# R version 3.2.3 (2015-12-10)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows >= 8 x64 (build 9200)
# RStudio (0.99.491) 
kevinushey commented 8 years ago

A new version of RStudio, v0.99.879, was released recently. Can you try updating your version of RStudio and see if this problem still reproduces?

https://www.rstudio.com/products/rstudio/download/

If so, can you follow up with explicit details on how to reproduce this -- e.g. how exactly are you activating packrat for this project?

In addition, can you see if there is any relevant information in the diagnostics logs?

diagnostics

Within the opened folder, you should see a file called rsession-<name>.log -- if you see any output relevant to this error can you post that here as well?

GegznaV commented 8 years ago

I updated to the latest version or "RStudio". The problem persists. May any (default) settings in "Windows 10" cause this problem?

How do I activate packrat? In the R session I select tab "Packages" and push button "Packrat". Then "Project options opens", I tick "Use packrat with this project" and then tick all 4 following boxes. Then click "OK".

Messages during initialization of packrat (truncation marked as /.../):

packrat::init(options = list(vcs.ignore.src = TRUE, use.cache = TRUE))
Initializing packrat project in directory:
- "~/R/spHelper"

Adding these packages to packrat:
                 _              
    BH             1.60.0-1  
/.../

Fetching sources for BH (1.60.0-1) ... OK (CRAN current)
/.../

Installing BH (1.60.0-1) ... 
/.../ 
    OK (built source)
Initialization complete!
Warning messages:
1: replacing previous import by ‘grid::unit’ when loading ‘hyperSpec’ 
2: replacing previous import by ‘hyperSpec::collapse’ when loading ‘spHelper’ 
3: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
  cannot open compressed file 'D:/Dokumentai/R/spHelper/packrat/lib/x86_64-w64-mingw32/3.2.3/BH/DESCRIPTION', probable reason 'Improper link'
4: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
  cannot open compressed file 'D:/Dokumentai/R/spHelper/packrat/lib/x86_64-w64-mingw32/3.2.3/Rcpp/DESCRIPTION', probable reason 'Improper link'
5: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
  cannot open compressed file 'D:/Dokumentai/R/spHelper/packrat/lib/x86_64-w64-mingw32/3.2.3/Rcpp/DESCRIPTION', probable reason 'Improper link'
6: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
  cannot open compressed file 'D:/Dokumentai/R/spHelper/packrat/lib/x86_64-w64-mingw32/3.2.3/Rcpp/DESCRIPTION', probable reason 'Improper link'

Restarting R session...

Packrat is not installed in the local library -- attempting to bootstrap an installation...
> Installing packrat into project private library:
- "D:/Dokumentai/R/spHelper/packrat/lib/x86_64-w64-mingw32/3.2.3"
* installing *source* package 'packrat' ...
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem copying D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\DESCRIPTION to D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\00LOCK-packrat-222058723d7a8474e670cfc1d0b0b23bd4d2996c\packrat\DESCRIPTION: Improper link
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem reading dir D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\help: No such file or directory
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem reading dir D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\html: No such file or directory
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem copying D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\INDEX to D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\00LOCK-packrat-222058723d7a8474e670cfc1d0b0b23bd4d2996c\packrat\INDEX: Improper link
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem reading dir D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\Meta: No such file or directory
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem copying D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\NAMESPACE to D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\00LOCK-packrat-222058723d7a8474e670cfc1d0b0b23bd4d2996c\packrat\NAMESPACE: Improper link
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem copying D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\NEWS.md to D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\00LOCK-packrat-222058723d7a8474e670cfc1d0b0b23bd4d2996c\packrat\NEWS.md: Improper link
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem reading dir D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\R: No such file or directory
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem reading dir D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\resources: No such file or directory
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem reading dir D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\rstudio: No such file or directory
Warning in file.copy(instdir, lockdir, recursive = TRUE, copy.date = TRUE) :
  problem reading dir D:\Dokumentai\R\spHelper\packrat\lib\x86_64-w64-mingw32\3.2.3\packrat\tests: No such file or directory
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (packrat)
> Attaching packrat
> Restoring library
Installing BH (1.60.0-1) ...

The messages, in log file ,that occurred during packrat initialization:

03 Mar 2016 09:49:24 [rsession-ViG] ERROR system error 17 (The system cannot move the file to a different disk drive) [path=D:/Dokumentai/R/spHelper/packrat/lib-R/utils/tests]; OCCURRED AT: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:309; LOGGED FROM: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:309
03 Mar 2016 09:49:24 [rsession-ViG] ERROR system error 17 (The system cannot move the file to a different disk drive) [path=D:/Dokumentai/R/spHelper/packrat/lib-R/utils/tests]; OCCURRED AT: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:309; LOGGED FROM: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:309

The message, in log file, when I try to open the session with packrat:

"03 Mar 2016 09:54:25 [rsession-ViG] ERROR r error 4 (R code execution error) [errormsg=Error in (function (package, help, pos = 2, lib.loc = NULL, character.only = FALSE,  : |||  ‘utils’ is not a valid installed package|||]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*) C:\Users\Administrator\rstudio\src\cpp\r\RExec.cpp:149; LOGGED FROM: rstudio::core::Error rstudio::r::session::initialize() C:\Users\Administrator\rstudio\src\cpp\r\session\RSession.cpp:381
03 Mar 2016 09:54:25 [rsession-ViG] ERROR r error 4 (R code execution error) [errormsg=Error in as.environment(pos) : |||  no item called "package:utils" on the search list|||]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::evaluateString(const string&, SEXPREC**, rstudio::r::sexp::Protect*) C:\Users\Administrator\rstudio\src\cpp\r\RExec.cpp:272; LOGGED FROM: int rstudio::r::session::RReadConsole(const char*, CONSOLE_BUFFER_CHAR*, int, int) C:\Users\Administrator\rstudio\src\cpp\r\session\RSession.cpp:693"
kevinushey commented 8 years ago

Hi @GegznaV,

Sorry for getting back to you so late. I think the issue here is that you're attempting to use packrat with the caching functionality, but this doesn't seem to be working as expected on Windows (it's still under development + mostly testing on Linux / OS X at this point).

I'll investigate a bit more and see if we can make this work on Windows as well.