rstudio / rstudio/packrat

Can't activate packrat if not in the packrat project

Open
#496 21 comments 0 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

packrat::on() has a project argument that should allow to activate a project from another working directory. My use case to find this error is using packrat with docker and shiny server.

When I am in let's say the user home and I want to activate packrat with packrat::on() after unbundling, I run

Rscript -e "packrat::on('/srv/shiny-server/app_folder')" 

I get this error message

Error in read.dcf(...) : cannot open the connection
Calls: <Anonymous> ... getPackageDependencies -> readLockFilePackages -> readDcf -> read.dcf
In addition: Warning message:
In read.dcf(...) :
  cannot open compressed file '//packrat/packrat.lock', probable reason 'No such file or directory'
Execution halted

This is because somewhere getPackageDependencies is called without any project argument and readLockFilePackages(file = lockFilePath()) is run searching for packrat.lock in the current working directory.

Before investigating further, is this an intended use of the project argument from packrat::on ?

Thanks.

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 packrat::on and trace how its project argument reaches getPackageDependencies, readLockFilePackages, readDcf, and lockFilePath. Reproduce the Rscript command from another working directory and inspect how packrat.lock is resolved. Done means activating the target project uses its lock file instead of searching the current directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.