rstudio / rstudio/packrat

Making devtools an external package leads to errors in RStudio, but not in console R

Open
#170 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Test script:

#!/bin/sh

set -x
set -e

rm -rf test
mkdir test
cd test
Rscript -e "options(repos='http://cran.rstudio.com'); packrat::init(options = list(external.packages = 'devtools', load.external.packages.on.startup = FALSE))"
echo "Version: 1.0" > test.Rproj
rm -rf packrat/lib*
R --no-save --interactive < /dev/null

After opening test.Rproj, RStudio is started with the following message on the console:

Error installing package: Error in results[sapply(results, Negate(isTRUE))] : 
  invalid subscript type 'list'
Calls: source ... afterPackratModeOn -> updateSettings -> symlinkExternalPackages
In addition: Warning messages:
1: In FUN("devtools"[[1L]], ...) :
  Package 'devtools' not available in repository or locally
2: In symlinkExternalPackages(project = project) :
  The following external packages could not be located:
- 'devtools'
Execution halted

Error installing package: Error in results[sapply(results, Negate(isTRUE))] : 
  invalid subscript type 'list'
Calls: source ... afterPackratModeOn -> updateSettings -> symlinkExternalPackages
In addition: Warning messages:
1: In FUN("devtools"[[1L]], ...) :
  Package 'devtools' not available in repository or locally
2: In symlinkExternalPackages(project = project) :
  The following external packages could not be located:
- 'devtools'
Execution halted

Then:

> library(devtools)
Error in library(devtools) : there is no package called ‘devtools’
> devtools::install
Error in loadNamespace(name) : there is no package called ‘devtools’
> packrat::on()
Packrat mode on. Using library in directory:
- "/home/muelleki/tmp/packrat-infer/test/packrat/lib"
> library(devtools)
>

Tested with current version e0d8f9b6cfa82.

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 reproduced shell script and the afterPackratModeOn -> updateSettings -> symlinkExternalPackages call path shown in the error. Compare external.packages handling between console R and RStudio, then verify that devtools can be loaded after opening test.Rproj without the invalid-subscript error.

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.