Symlinking system packages fails with Hombrew-upgraded R
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 409
- Forks
- 89
- PR merge metrics
- No merged PRs in 30d
Description
I am using R 3.5.2_2 under macOS, installed via Homebrew with Packrat 0.5.0.
When Homebrew upgrades R to a new version, a new library is created, living in /usr/local/Cellar/r/3.5.2_2/lib/R/library, in contrast to the previous one at /usr/local/Cellar/r/3.5.2/lib/R/library.
Issue
When opening a Packrat project that I previously created with an old version of R, I get this error:
In file.symlink(from, to) :
cannot symlink '/usr/local/Cellar/r/3.5.2_2/lib/R/library/base' to '/Users/werner/Documents/Projects/foo-data-analysis/data-analyze/rscript/packrat/lib-R/x86_64-apple-darwin17.7.0/3.5.2/base', reason 'File exists
And of course these files already exist:
➜ ll lib-R/x86_64-apple-darwin17.7.0/3.5.2/
total 0
lrwxr-xr-x 1 werner staff 50 Jan 4 16:09 KernSmooth -> /usr/local/Cellar/r/3.5.2/lib/R/library/KernSmooth
lrwxr-xr-x 1 werner staff 44 Jan 4 16:09 MASS -> /usr/local/Cellar/r/3.5.2/lib/R/library/MASS
lrwxr-xr-x 1 werner staff 46 Jan 4 16:09 Matrix -> /usr/local/Cellar/r/3.5.2/lib/R/library/Matrix
lrwxr-xr-x 1 werner staff 44 Jan 4 16:09 base -> /usr/local/Cellar/r/3.5.2/lib/R/library/base
...
They point to the old R library.
Expected behavior
My understanding is that these symlinks should always point to the actual system library, which is correctly printed in .libPaths():
> .libPaths()
[1] "/Users/werner/Documents/Projects/foo-data-analysis/data-analyze/rscript/packrat/lib/x86_64-apple-darwin17.7.0/3.5.2"
[2] "/Users/werner/Documents/Projects/foo-data-analysis/data-analyze/rscript/packrat/lib-ext/x86_64-apple-darwin17.7.0/3.5.2"
[3] "/usr/local/Cellar/r/3.5.2_2/lib/R/library"
Possible workaround
I can rm -rf lib-R and restart R, then the symlinks will be recreated.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how Packrat handles the lib-R directory and creates symlinks when an existing project opens, using the reported macOS R upgrade scenario and the displayed .libPaths() as the reproduction. Done means reopening the project after the system R library changes updates the symlinks to the current /usr/local/Cellar/r/.../lib/R/library without requiring lib-R to be removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, r
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100