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

Not recognising R interpreter #3832

Closed
skthewimp opened this issue Jul 3, 2024 · 22 comments
Closed

Not recognising R interpreter #3832

skthewimp opened this issue Jul 3, 2024 · 22 comments
Labels
bug Something isn't working lang: r support

Comments

@skthewimp
Copy link

Positron Version:

Steps to reproduce the issue:

  1. Open an R file
  2. Hit "run code"

What did you expect to happen?

The code to be run. Nothing happened. If I look at the interpreters on the top right, I only see Python, no R interpreters there. I've been using RStudio on my machine (with R 4.4.1) for a very long time now

Were there any error messages in the output or Developer Tools console?

No

@skthewimp skthewimp added the bug Something isn't working label Jul 3, 2024
@lionel-
Copy link
Contributor

lionel- commented Jul 3, 2024

Can you provide us with the Positron Extension log please? See #3791 (comment).

@lionel- lionel- added the lang: r label Jul 3, 2024
@skthewimp
Copy link
Author

2024-07-03 13:25:18.526 [info] Log level: Debug
2024-07-03 13:25:18.526 [info] Refreshing testthat status
2024-07-03 13:25:18.526 [info] Not working in an R package
2024-07-03 13:25:18.526 [info] Context key 'testthatIsConfigured' is 'false'
2024-07-03 13:25:18.526 [info] Context key 'testthatHasTests' is 'false'

@skthewimp skthewimp reopened this Jul 3, 2024
@lionel-
Copy link
Contributor

lionel- commented Jul 3, 2024

Can you provide the complete log please?

@skthewimp
Copy link
Author

this is all i can see. how can i find the complete log?

@lionel-
Copy link
Contributor

lionel- commented Jul 3, 2024

Gotcha! What's your operating system? Where is R installed on your machine and how did you install it?

@skthewimp
Copy link
Author

MacOS

/usr/local/bin/R

downloaded from the website (in fact after this i reinstalled and upgraded ot the latest version (4.4.1) )
R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

@py9mrg

This comment was marked as off-topic.

@jmcphers

This comment was marked as off-topic.

@jennybc
Copy link
Member

jennybc commented Jul 3, 2024

When you say "downloaded from the website", I assume you mean CRAN. Can you confirm? From the "Download and Install R" section of https://cran.r-project.org/.

Can you use R in the terminal? In RStudio? If so, what does R.home() show you in those contexts?

@skthewimp
Copy link
Author

Yes i can use everywhere. and I got it from cran

R.home() shows "/Library/Frameworks/R.framework/Resources"

@jennybc
Copy link
Member

jennybc commented Jul 4, 2024

Hmm, that's pretty surprising that the log just ends there 🤔

Maybe the developer tools is the next best place to look for info. How to access this is described in #3707 (reply in thread).

@jennybc
Copy link
Member

jennybc commented Jul 4, 2024

Can you also paste the content from Positron > About Positron, please?

For example, mine looks like:

Positron Version: 2024.06.1 (Universal) build 54
Code - OSS Version: 1.90.0
Commit: 5115c73e0670f39139e55eeedf0717b468a0658d
Date: 2024-07-03T03:51:33.756Z
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 22.6.0

@jennybc
Copy link
Member

jennybc commented Jul 4, 2024

And also show the result of R.version when you successfully run it through other means. Output will be something like this:

R.version
#>                _                           
#> platform       aarch64-apple-darwin20      
#> arch           aarch64                     
#> os             darwin20                    
#> system         aarch64, darwin20           
#> status                                     
#> major          4                           
#> minor          4.0                         
#> year           2024                        
#> month          04                          
#> day            24                          
#> svn rev        86474                       
#> language       R                           
#> version.string R version 4.4.0 (2024-04-24)
#> nickname       Puppy Cup

Created on 2024-07-03 with reprex v2.0.2

@skthewimp
Copy link
Author

Positron Version: 2024.06.1 (Universal) build 54
Code - OSS Version: 1.90.0
Commit: 5115c73
Date: 2024-07-03T03:51:33.756Z
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

@skthewimp
Copy link
Author

skthewimp commented Jul 4, 2024

platform aarch64-apple-darwin20
arch aarch64
os darwin20
system aarch64, darwin20
status
major 4
minor 4.1
year 2024
month 06
day 14
svn rev 86737
language R
version.string R version 4.4.1 (2024-06-14)
nickname Race for Your Life

@skthewimp
Copy link
Author

skthewimp commented Jul 4, 2024

I added this "/Library/Frameworks/R.framework/Resources" to my path, and now Positron is able to see the R interpreter.

however, i'm getting a new error now there (I've never had a problem on RStudio, btw. continues to work beautifully there)

Error: Socket connect timed out after 20 seconds
/usr/local/bin/R --connection_file /var/folders/v8/6twm3vf51cj3s4zz2c1v8pqr0000gn/T/kernel-JOwa4U/connection.json --log /var/folders/v8/6twm3vf51cj3s4zz2c1v8pqr0000gn/T/kernel-JOwa4U/kernel.log --startup-file /Applications/Positron.app/Contents/Resources/app/extensions/positron-r/resources/scripts/startup.R --session-mode console --startup-notifier-file /var/folders/v8/6twm3vf51cj3s4zz2c1v8pqr0000gn/T-JupyterDelayStartupTd0tTq/file -- --interactive --no-restore-data
WARNING: unknown option '--connection_file'

ARGUMENT '/var/folders/v8/6twm3vf51cj3s4zz2c1v8pqr0000gn/T/kernel-JOwa4U/connection.json' __ignored__

WARNING: unknown option '--log'

ARGUMENT '/var/folders/v8/6twm3vf51cj3s4zz2c1v8pqr0000gn/T/kernel-JOwa4U/kernel.log' __ignored__

WARNING: unknown option '--startup-file'

ARGUMENT '/Applications/Positron.app/Contents/Resources/app/extensions/positron-r/resources/scripts/startup.R' __ignored__

WARNING: unknown option '--session-mode'

ARGUMENT 'console' __ignored__

WARNING: unknown option '--startup-notifier-file'

ARGUMENT '/var/folders/v8/6twm3vf51cj3s4zz2c1v8pqr0000gn/T-JupyterDelayStartupTd0tTq/file' __ignored__

WARNING: unknown option '--'

@skthewimp
Copy link
Author

and the log:

2024-07-04 11:18:38.901 [info] Log level: Debug
2024-07-04 11:18:38.901 [info] Refreshing testthat status
2024-07-04 11:18:38.901 [info] Not working in an R package
2024-07-04 11:18:38.901 [info] Context key 'testthatIsConfigured' is 'false'
2024-07-04 11:18:38.901 [info] Context key 'testthatHasTests' is 'false'
2024-07-04 11:18:39.951 [info] Resolved R binary at /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/bin/R
2024-07-04 11:18:39.953 [info] Candidate R binary at /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/bin/R
2024-07-04 11:18:39.953 [info] R installation discovered: {
  "valid": true,
  "supported": true,
  "binpath": "/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/bin/R",
  "homepath": "/Library/Frameworks/R.framework/Resources",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.4.1",
    "major": 4,
    "minor": 4,
    "patch": 1,
    "prerelease": [],
    "build": [],
    "version": "4.4.1"
  },
  "version": "4.4.1",
  "arch": "arm64",
  "current": true,
  "orthogonal": false
}
2024-07-04 11:18:39.953 [info] Candidate R binary at /Library/Frameworks/R.framework/Versions/4.1/Resources/bin/R
2024-07-04 11:18:39.953 [info] R installation discovered: {
  "valid": true,
  "supported": true,
  "binpath": "/Library/Frameworks/R.framework/Versions/4.1/Resources/bin/R",
  "homepath": "/Library/Frameworks/R.framework/Resources",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.4.1",
    "major": 4,
    "minor": 4,
    "patch": 1,
    "prerelease": [],
    "build": [],
    "version": "4.4.1"
  },
  "version": "4.4.1",
  "arch": "arm64",
  "current": false,
  "orthogonal": false
}
2024-07-04 11:18:39.953 [info] Filtering out /Library/Frameworks/R.framework/Versions/4.1/Resources/bin/R: not current and also not orthogonal.
2024-07-04 11:18:39.954 [info] Resolved R binary at /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/bin/R
2024-07-04 11:18:39.954 [info] Candidate R binary at /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/bin/R
2024-07-04 11:18:39.954 [info] R installation discovered: {
  "valid": true,
  "supported": true,
  "binpath": "/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/bin/R",
  "homepath": "/Library/Frameworks/R.framework/Resources",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.4.1",
    "major": 4,
    "minor": 4,
    "patch": 1,
    "prerelease": [],
    "build": [],
    "version": "4.4.1"
  },
  "version": "4.4.1",
  "arch": "arm64",
  "current": true,
  "orthogonal": false
}

@jennybc
Copy link
Member

jennybc commented Jul 5, 2024

I think this got buried by my other requests. I still think it would be useful to get a look at the developer tools.

Maybe the developer tools is the next best place to look for info. How to access this is described in #3707 (reply in thread).

Update: maybe that's where the snippet in #3832 (comment) came from? Can you confirm?

@jennybc
Copy link
Member

jennybc commented Jul 5, 2024

Jotting down a few notes mostly to myself: I find it odd that adding "/Library/Frameworks/R.framework/Resources" to the PATH unblocked discovery of multiple R versions (vs. just the current version). I tend to think there is something intermittent happening that ?perhaps causes a timing problem / delay? and that some random positive event coincided with modifying the PATH, i.e. that that is a red herring. Because this log looks completely normal to me now: #3832 (comment). Is the "Error: Socket connect timed out after 20 seconds" the real thread to pursue?

@jennybc
Copy link
Member

jennybc commented Jul 5, 2024

More observations:

Error: Socket connect timed out after 20 seconds
/usr/local/bin/R --connection_file .... <lots of warnings about unknown options>

The equivalent log for me shows:

[R] /Applications/Positron.app/Contents/Resources/app/extensions/positron-r/resources/ark/ark --connection_file /var/folders/zb/yzf8zvwd4p1dq8q3bfjz4tt80000gp/T/kernel-NdoQjM/connection.json --log /var/folders/zb/yzf8zvwd4p1dq8q3bfjz4tt80000gp/T/kernel-NdoQjM/kernel.log --startup-file /Applications/Positron.app/Contents/Resources/app/extensions/positron-r/resources/scripts/startup.R --session-mode console -- --interactive --no-restore-data

Can you do ls -al /usr/local/bin/R? I see

~/rrr/positron % ls -al /usr/local/bin/R
lrwxr-xr-x  1 root  admin  47  3 May 07:55 /usr/local/bin/R -> /Library/Frameworks/R.framework/Resources/bin/R

I.e. the R there is a symlink pointing at an actual R binary (via another symlink). From some of your output, it feels like this may not be true for you?

FWIW I highly recommend managing one's R installations via rig, if you are open to that: https://github.com/r-lib/rig. If you intend to have more than 1 R installation that is usable, you almost have to do that.

@jennybc
Copy link
Member

jennybc commented Jul 5, 2024

Have you done anything with this bit of configuration re: the Ark kernel (Positron > R > Kernel: Path)? If so, what? It should be unset for a typical user.

Screenshot 2024-07-05 at 11 52 38 AM

@skthewimp
Copy link
Author

Phew! that was it! While my system wasn't able to locate the interpreter, I had assumed this is where you set the path, and i ahd put somethign there.

Now, FINALLY, it's all working for me! Thanks so much for all the support.

lionel- added a commit that referenced this issue Jul 13, 2024
Intent: Avoid confusion such as in
#3832 where a user thought
the path for Ark was the path for R.

- Add a note that path to Ark is not path to R

- Split advanced settings into a separate section. This way the most
useful user settings are separated from the dev or debug settings and
are easier for users to skim through. It might also give pause before
trying adanced settings like the path to Ark.



https://github.com/posit-dev/positron/assets/4465050/669161e2-3d54-4e9e-8a36-9c25fe39781a
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working lang: r support
Projects
None yet
Development

No branches or pull requests

6 participants