Open AmeliaMN opened 8 years ago
I tried initializing a packrat project using this lockfile, and then opening the project in RStudio, but did not see an X11 window opened. Can you provide more information?
@AmeliaMN was seeing XQuartz open up for no good reason while running RStudio; we eventually realized it was a side effect of packrat init and were able to get it to repro outside RStudio just by running packrat::init on the project directory in RGui.
I'd initially thought it was due to one of the packages above (and it probably is) but just doing a library()
on each, one-by-one, didn't cause the X11 window to open. Something else happening on init is triggering it.
This used to be a problem with an old version of colorspace, so I suspect a similar mechanism is responsible here:
https://stackoverflow.com/questions/28952128/loading-ggplot2-colorspace-actually-opens-up-x11
One potential culprit -- for autocompletion results, RStudio will launch an R process in the background and load packages discovered in the current project + open R scripts (with a library()
call). It's possible that one of those launched R processes was loading a package (perhaps colorspace) and causing an X11 window to open when that package was loaded.
Hmm, I don't know how to troubleshoot this further. Let me know any information that would be helpful, and/or I can bring my laptop past the booth at JSM.
I just tried to add packrat (.4.7-1 on CRAN) to my new project in rstudio, and right when I restarted my r session, XQuartz pops up. Below is what my output is, and my sessioninfo: Let me know if there is any way I can help with this issue. I am using RStudio 0.99.1294
Update: I tried using the dev version of packrat 0.4.7-23, and it still seems like the issue may have been fixed. I'll keep you updated on anything I run into
packrat::init()
Initializing packrat project in directory:
- "~/Desktop/Global Superstore Analysis"
Adding these packages to packrat:
_
packrat 0.4.7-1
Fetching sources for packrat (0.4.7-1) ... OK (CRAN current)
Snapshot written to '/Users/petergensler/Desktop/Global Superstore Analysis/packrat/packrat.lock'
Installing packrat (0.4.7-1) ...
OK (downloaded binary)
Initialization complete!
Restarting R session...
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] packrat_0.4.7-1 dplyr_0.5.0
loaded via a namespace (and not attached):
[1] magrittr_1.5 R6_2.1.3 assertthat_0.1 DBI_0.5 tools_3.3.1 tibble_1.2
[7] Rcpp_0.12.6
Interesting, thanks. One other data point -- do you see this only within RStudio, or do you see it within a plain R session as well?
I have not tried it in R yet. I will let you know if anything odd happens.
Tried installing the dev version of packrat as well as the CRAN version in R 3.3.1, and XQuartz was fine, so I'm guessing it has something to do with RStudio(maybe something with notebooks..?)? I'm not really sure what dependencies have the XQuartz/X11 stuff in RStudio, so I really don't know where to start debugging an issue like this. Let me know if there is any other way I can help.
One possibility would be to try debugging the functions that are commonly used to open an X11 window, e.g.
debug(x11)
debug(X11)
debug(dev.new)
and then trying to run the packrat code that causes an X11 device to be opened; this might pause the R session in the code that's opening a graphics device, and then we could see who the ultimate culprit is re: opening an X11 graphics device.
I tried
debug(x11)
debug(X11)
debug(dev.new)
and wasn't able to catch anything. However, updating to the dev version of packrat seems to have fixed the issue for me.
Great to hear! It's unfortunate we still don't know the underlying cause, but I'll take that as a win anyhow...
I, too, am having this issue. XQuartz only started opening whenever I open RStudio about a month ago and I don't believe I'm using any new or strange packages. I downloaded the dev version of packrat but that didn't make a difference for me. Are there any updates or other fixes that have worked for anyone? Thank you!
fwiw, also seeing this with packrat::init()
in an empty directory from the R console with a fresh install of R on Mac.
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 6): Library not loaded: /opt/X11/lib/libSM.6.dylib
Referenced from: /Library/Frameworks/R.framework/Resources/modules//R_X11.so
Reason: image not found
Packrat: 0.5.0 R: 3.5.1 Mac: Mojave
You likely need to reinstall XQuartz: https://www.xquartz.org/
Yeah, that fixed the warning, but thought it was odd that packrat::init()
tried to use X11/XQuartz.
My best guess is that Packrat loaded the namespace of a package which uses X11 during init.
Hmm, happens when I run the init in an empty directory, so maybe one of the libraries Packrat depends on, like tools
or utils
🤷♂️
I have also experienced this for a long time (perhaps one or two years) in one of my projects, and finally bothered to google for this mystery. I still don't know what the cause was, but I deleted the .Rproj.user
directory in the project, and XQuartz no longer automatically launches when I open that RStudio project. I think this issue is irrelevant to packrat, because I didn't use it in that project. A certain R package might have triggered XQuartz, and RStudio remembered it somehow.
FWIW I recall rgl
being one of the culprits in terms of "packages that automatically open an XQuartz window when loaded".
I recently had this issue and fixed it by deleting the R project related files, *.Rproj
and .Rproj.user
. I had a script using the rgl
package, which is the only thing related to XQuartz I know.
@jmcphers said the lock file might make it easier to reproduce this issue, so here it is: