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

Does {startup} work with positron? #136

Open
baslat opened this issue Jul 29, 2024 · 9 comments
Open

Does {startup} work with positron? #136

baslat opened this issue Jul 29, 2024 · 9 comments
Milestone

Comments

@baslat
Copy link

baslat commented Jul 29, 2024

The startup package doesn't seem to work with position. I use {startup} with VSC all the time without issue, however it doesn't work in positron (not even if I trigger it manually with startup::startup()). I wonder if this could be related to ark?

@HenrikBengtsson HenrikBengtsson added this to the Next release milestone Jul 30, 2024
@HenrikBengtsson
Copy link
Owner

I'm not a user of Positron. Does the ordinary ~/.Rprofile startup script work? Please verify that first; if that doesn't work, then report that to the Positron issue tracker. Without it, startup cannot work.

@baslat
Copy link
Author

baslat commented Jul 30, 2024

Yes, the ordinary ~/.Rprofile script works. If I set it to startup::startup(debug = TRUE) it seems as though it's not finding the ~/.Rprofile.d folder

# Positron
0.004s: startup::startup()-specific processing ...
0.004s: Found 'startup' directory '~/.Renviron.d'.
0.009s: - unloading the 'startup' package

# VSCode
0.005s: startup::startup()-specific processing ...
0.005s: Found 'startup' directory '~/.Renviron.d'.
0.007s: Found 'startup' directory '~/.Rprofile.d'.
0.013s: Processing 11 Rprofile files ...

@HenrikBengtsson
Copy link
Owner

That's all the output?

0.007s: Found 'startup' directory '~/.Rprofile.d'.
0.013s: Processing 11 Rprofile files ...

It clearly finds the folder and it identifies 11 files there-in.

@HenrikBengtsson
Copy link
Owner

You can also try to call

startup::startup(debug = TRUE

from the Positron prompt and see what you get. If you get an error, what does traceback() report?

@baslat
Copy link
Author

baslat commented Jul 30, 2024

The VSCode output is an example of {startup} working as expected, in contrast to the output from Positron which doesn't seem to find the ~/.Rprofile.d folder.

Manually running startup::startup(debug = TRUE) in Positron doesn't throw an error, but doesn't load the expected behaviour, as it doesn't find the ~/.Rprofile.d folder (same behaviour as when running on startup in Positron).

Here are the full logs from Positron

> startup::startup(debug = TRUE)
0.000s: System information:
0.001s: - R_HOME: '/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources' (existing folder)
0.001s: - R call: ark --interactive --no-restore-data --quiet --no-site-file --no-init-file
0.001s: - Current directory: '/Users/bas'
0.001s: - User's home directory: '~' => '/Users/bas' (existing folder)
0.002s: - User's 'startup' config directory: '/Users/bas/Library/Preferences/org.R-project.R/R/startup' (non-existing directory)
0.002s: - Search path: '.GlobalEnv', 'tools:rstudio', 'tools:positron', 'package:stats', 'package:graphics', 'package:grDevices', 'package:utils', 'package:datasets', 'package:methods', 'Autoloads', 'package:base'
0.002s: - Loaded namespaces: 'compiler', 'startup', 'graphics', 'tools', 'utils', 'grDevices', 'stats', 'datasets', 'methods', 'base'
0.002s: The following has already been processed by R:
0.002s: - R_ENVIRON: ''
0.002s: - R_ENVIRON_USER: ''
0.003s: - '/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/etc/Renviron' (23 lines; 1989 bytes) setting 23 environment variables ('R_PLATFORM', 'R_PAPERSIZE_USER', 'R_PAPERSIZE', 'R_PRINTCMD', 'R_RD4PDF', 'R_TEXI2DVICMD', 'R_GZIPCMD', 'R_UNZIPCMD', 'R_ZIPCMD', 'R_BZIPCMD', 'R_BROWSER', 'EDITOR', 'PAGER', 'R_PDFVIEWER', 'LN_S', 'MAKE', 'SED', 'TAR', 'R_STRIP_SHARED_LIB', 'R_STRIP_STATIC_LIB', 'R_LIBS_USER', 'R_LIBS_SITE', 'R_QPDF')
0.004s: - '.Renviron' (24 lines; 1344 bytes) setting 24 environment variables (**MY-ENV-VARS**)
0.004s: - tempdir(): '/var/folders/22/ln8pw35953b4hggsldkqb7mm0000gp/T//Rtmp5VqSue' (existing folder)
0.004s:   - TMPDIR: ‘/var/folders/22/ln8pw35953b4hggsldkqb7mm0000gp/T/’
0.004s:   - TMP: ‘’
0.004s:   - TEMP: ‘’
0.004s: - R_LIBS: ''
0.004s: - R_LIBS_SITE: '/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/site-library'
0.004s: - R_LIBS_USER: '/Users/bas/Library/R/arm64/4.4/library'
0.004s: - R_SCRIPT_DEFAULT_PACKAGES (only if Rscript was used): ''
0.005s: - R_DEFAULT_PACKAGES: '' (= 'base,methods,datasets,utils,grDevices,graphics,stats')
0.005s: - '/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/base/R/Rprofile' (160 code lines; 7953 bytes)
0.005s: - R_PROFILE: ''
0.005s: - R_PROFILE_USER: ''
0.005s: startup::startup()-specific processing ...
0.006s: Found 'startup' directory '~/.Renviron.d'.
0.010s: - unloading the 'startup' package
0.010s: - Search path: '.GlobalEnv', 'tools:rstudio', 'tools:positron', 'package:stats', 'package:graphics', 'package:grDevices', 'package:utils', 'package:datasets', 'package:methods', 'Autoloads', 'package:base'
0.010s: - Loaded namespaces: 'compiler', 'graphics', 'tools', 'utils', 'grDevices', 'stats', 'datasets', 'methods', 'base'
0.010s: startup::startup()-specific processing ... done
0.010s: The following will be processed next by R:
0.010s: - R_HISTFILE: ''
0.010s: - .First(): no such function on search()
0.011s: - Remaining packages per R_DEFAULT_PACKAGES to be attached by base::.First.sys() (in order): 
0.011s: - The R just-in-time (JIT) compiler:
0.011s:   - R_ENABLE_JIT: <not set>
0.011s:   - JIT compiler enabled by default
0.011s: The following will be processed when R terminates:
0.011s: - .Last(): no such function on search()
0.011s: - .Last.sys(): no such function on search()

HenrikBengtsson added a commit that referenced this issue Aug 2, 2024
@HenrikBengtsson
Copy link
Owner

HenrikBengtsson commented Aug 2, 2024

I think I've identified the reason, and it has to do with Positron launching R using:

ark --interactive --no-restore-data --quiet --no-site-file --no-init-file

Specifically, startup::startup() sees --no-site-file and --no-init-file and interpret those as the Rprofile scripts should not be processed. I don't understand why they use those command-line options, but maybe there's a good reason. Until that is better understood, you can update your ~/.Rprofile script to use:

startup::startup(skip = FALSE)

That tells startup() to ignore any --no-site-file and --no-init-file options.

@baslat
Copy link
Author

baslat commented Aug 6, 2024

I'll try that out. I also updated to the dev version of {startup} asI saw you made some commits and get this error:

.Rprofile error: could not find function "is_ark"

@HenrikBengtsson
Copy link
Owner

.Rprofile error: could not find function "is_ark"

Oops - forgot to add some new files to repo.

@baslat
Copy link
Author

baslat commented Aug 6, 2024

Nice, things seem to be working now, thanks!

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