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

Problems running cat() in .Rprofile at start up #6344

Open
davidkane9 opened this issue Feb 13, 2025 · 6 comments
Open

Problems running cat() in .Rprofile at start up #6344

davidkane9 opened this issue Feb 13, 2025 · 6 comments
Labels
area: kallichore Issues related to the new kernel supervisor bug Something isn't working lang: r

Comments

@davidkane9
Copy link

Type: Bug

Edit your .Rprofile to include a line like:

cat("This is the .Rprofile in my home directory.")

Restart your R session within Positron. In Positron, I see:

R 4.4.2 exited (preparing for restart)
R 4.4.2 restarted.
>

What I expect to see is something like:

R 4.4.2 exited (preparing for restart)
R 4.4.2 restarted.
This is the .Rprofile in my home directory.
>

VS Code version: Positron 1.96.0 (Universal) (55f7331, 2025-02-10T16:03:19.797Z)
OS version: Darwin arm64 23.6.0
Modes:

System Info
Item Value
CPUs Apple M1 Max (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 4, 3, 3
Memory (System) 64.00GB (15.68GB free)
Process Argv
Screen Reader no
VM 0%
Extensions: none
@DavisVaughan
Copy link
Contributor

I imagine it is running, i.e. if you put x <- 1 in there, you can probably type x in the console and see that it is assigned to 1. But that cat() output isn't appearing right now, though I would have sworn we fixed that...

@davidkane9
Copy link
Author

Thanks. x <- 1 does indeed work.

But source("renv/activate.R") does not, which is my actual underlying problem.

@DavisVaughan
Copy link
Contributor

@jmcphers this seems to be an issue with the kernel supervisor. If I turn off the kernel supervisor and go back to the jupyter adaptor, then I see the cat() output, but with the supervisor on, I do not see it. This does happen very very early in the lifecycle of the kernel, so that probably has something to do with it

@DavisVaughan
Copy link
Contributor

DavisVaughan commented Feb 13, 2025

If you put both of these in the same Rprofile, then do you still see x in the console? If so, then source() is also definitely running, but is possibly erroring for some reason and the error is getting swallowed.

x <- 1
source("renv/activate.R")

@davidkane9
Copy link
Author

Yes, with this:

x <- 1
source("renv/activate.R")

x is available. But, with:

source("renv/activate.R")
x <- 1

x is not available. So, presumably, source("renv/activate.R") is causing some silent error. This is not good for those of us who use renv.

If I run the source() command directly at the Console, all looks good:

> source("renv/activate.R")
- Project '~/Desktop/projects/tutorial.helpers' loaded. [renv 1.1.1]
>

@juliasilge juliasilge changed the title R is not reading .Rprofile at start up Problems running cat() in .Rprofile at start up Feb 13, 2025
@juliasilge juliasilge added bug Something isn't working lang: r area: kallichore Issues related to the new kernel supervisor labels Feb 13, 2025
@juliasilge
Copy link
Contributor

Maybe a regression for #1481?

Perhaps we should consider a test with cat() in an .Rprofile to keep us from breaking this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: kallichore Issues related to the new kernel supervisor bug Something isn't working lang: r
Projects
None yet
Development

No branches or pull requests

3 participants