rstudio package building install button uses wrong .Rprofile?

I am developing a package and using renv. The package has it's own .Rprofile file, which was created during the renv initialisation.

I also have a user level .Rprofile, which naturally doesn't apply to this package. Shouldn't anyway. This file includes some code that uses the DBI package, which will become relevant in a second.

Here's my issue: when I use the "Install" button on the Build pane* I get the error:

Error in loadNamespace(x) : there is no package called 'DBI'
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted

Which means that the "Install" button is running the wrong .Rprofile when restarting the session. The only reason I am noticing this is because using renv means I don't have this particular library installed for this project.

Obviously I could just do that and it would solve my immediate issue. But do I have this wrong or am I missing a setting somewhere?

* I believe this used to be called Build and reload, which was a more descriptive term and def made it easier to google. Also, the documentation (e.g. this recent article on posit.co) still use the old nomenclature, which is super confusing.

It is also possible that RStudio uses an R session that does not load any profiles.

In any case, this sounds like a bug to me. Could you please open an issue in the rstudio/rstudio GitHub repository? Thanks!

Thanks Gabor, I'll do that then.
And it definitely loads an .Rprofile - I know that not only because it's missing the DBI package in my case, but I also just added a message to the user .Rprofile and it printed out in the build pane.

Here's the issue on github

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.