Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open RStudio in Nix environment #146

Closed
gueyenono opened this issue Feb 25, 2024 · 6 comments
Closed

Cannot open RStudio in Nix environment #146

gueyenono opened this issue Feb 25, 2024 · 6 comments

Comments

@gueyenono
Copy link

I am currently reading the vignette: "e - Interactive use" and I am not able to use RStudio in my Nix environment despite following the instructions. I get the following error

TTY detected. Printing informational message about logging configuration. Logging configuration loaded from '/etc/xdg/xdg-pop:/etc/xdg/rstudio/logging.conf'. Logging to '/home/gueyenono/.local/share/rstudio/log/rdesktop.log'.
Gtk-Message: 00:30:19.763: Failed to load module "canberra-gtk-module"
Gtk-Message: 00:30:19.763: Failed to load module "canberra-gtk-module"
qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
Could not initialize GLX
Aborted (core dumped)

So I added the following to the system_pkgs argument of the rix::rix() function: libcraberra, libcraberra-gtk2 and libcraberra-gtk3 (which I found on <search.nixos.org>). However, this has not solved the issue. Here is my full function call:

rix(r_ver = "latest",
    r_pkgs = c("dplyr", "ggplot2"),
    system_pkgs = c("libcanberra", "libcanberra-gtk2", "libcanberra-gtk3"),
    git_pkgs = NULL,
    ide = "rstudio",
    project_path = here::here(),
    overwrite = TRUE,
    print = TRUE)

Here is my session info:

R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 22.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: America/Chicago
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.3.2

Thank you for your time in helping me solving this issue.

@b-rodrigues
Copy link
Owner

I've had a similar issue, and didn't think that it could be common... but open a terminal, and before dropping into the shell, run:

xhost + local:

then drop in the shell, and run rstudio. You shouldn't need the canberra libraries either, so maybe try to remove these as well.

@gueyenono
Copy link
Author

Unfortunately, this solution did not work for me. I tried to rebuild the environment with and without the canberra modules with no success.

@b-rodrigues
Copy link
Owner

Ok, so could you drop into the shell and then run:

export QT_XCB_GL_INTEGRATION=none

and then rstudio? If this is more common than what I thought, we'll have to document this.

@gueyenono
Copy link
Author

This solution works! I honestly think it would not hurt to document it.

I have a quick question. I get hit with an RStudio update notification (which makes sense). What happens if I decide to go ahead and update it? Will I just be able to use the updated version only for the duration of the current session.

@b-rodrigues
Copy link
Owner

The latest Rstudio is awaiting merge: NixOS/nixpkgs#289393

I think that if you would click on the notification to get the newest Rstudio, it likely would not work.

@b-rodrigues
Copy link
Owner

This solution works! I honestly think it would not hurt to document it.

Thanks, done with 4579e68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants