can't initialize existing project with packrat

I have a working project on Rstudio Server I want to set fixed all packages into the actual working versions to avoid future issues due to global library updates.

So I run

`> packrat::init()

Initializing packrat project in directory: - "~/R/statistics"`

After a while all packages are downloaded and installed with no apparent issue. So I run

packrat::status()

and I get:

Error: This project has not yet been packified. Run 'packrat::init()' to init packrat.

Restarted R session, Rstudio and even server, but to no avail. Same message no matter I insisted.

Rstudio Server version 1.1.456
R version : 3.4.4

1 Like

After packrat::init(), what does the packrat/* folder look like? The packrat.lock file, etc.? One issue you may be having is that packrat is not "on." packrat::on() is the solution here, and should work if your current working directory is in the project directory.

The other way you can check to see if packrat has done its "magic" is to look at .libPaths(). If packrat is "on," then your libpaths should point to the packrat/* folders for packages.

One final way is by sourcing the packrat/init.R file with source("packrat/init.R") (which is added to your .Rprofile by default).

I'm curious to hear about the state of your directory when you experience this problem!

1 Like