SublimeREPL Unable to Find R
Asked Answered
A

2

12

Okay, this is driving my crazy. I had set this up before, deleted Sublime Text, and now I can't remember what the right configuration was.

Very simple: I'm running R through SublimeREPL and need to point the REPL to where R is installed.

I followed the directions at http://sublimerepl.readthedocs.org/en/latest/, which say to go into the user-defined REPL settings and add this:

{
 ...
 "default_extend_env": {"PATH": "{PATH}:/home/myusername/bin"}
 ...
} 

where the path points to the right directory. I tried replacing it with

{
 ...
 "default_extend_env": {"PATH": "C:/Program Files/R/R-3.0.2/bin"}
 ...
}

and it's still unable to find R, plus now it's giving me the error:

Error trying to parse settings: Expected value in Packages\User\SublimeREPL.sublime-     settings:2:2

I know this is an easy fix. Can anybody point out what I'm doing wrong here?


*I'm using Sublime Text 3. I previously had this working, but on Sublime Text 2.

Ajani answered 14/1, 2014 at 13:54 Comment(0)
N
16

Go to Preferences -> Browse Packages... and create a directory tree User/SublimeREPL/config/R. In that directory, create a new file named Main.sublime-menu with the following contents:

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {"command": "repl_open",
                 "caption": "Rterm",
                 "id": "repl_r",
                 "mnemonic": "r",
                 "args": {
                    "type": "subprocess",
                    "external_id": "r",
                    "additional_scopes": ["tex.latex.knitr"],
                    "encoding": {"windows": "$win_cmd_encoding"},
                    "soft_quit": "\nquit(save=\"no\")\n",
                    "cmd": {"windows": ["C:/Program Files/R/R-3.0.2/bin/x64/Rterm.exe", "--ess", "--encoding=$win_cmd_encoding"]},
                    "cwd": "$file_path",
                    "extend_env": {"windows": {"PATH": "{PATH}:/C/Program Files/R/R-3.0.2/bin"}},
                    "cmd_postfix": "\n",
                    "suppress_echo": {"windows": false},
                    "syntax": "Packages/R/R.tmLanguage"
                    }
                }
            ]
        }]
    }
]

Save the file, and you should now have a Tools -> SublimeREPL -> Rterm menu option. Double-check that the path is the correct one to the Rterm.exe file. On my computer (32-bit XP) it's in the i386 subfolder of bin, so yours may be in bin/x64 or something like that.

I hope this helps, let me know if you still have issues.

Notice answered 14/1, 2014 at 15:56 Comment(5)
Thanks! I'm running into major issues with this. 1) When I go to Preferences --> Browse Packages, there are two folders: One for User and another for SublimeREPL. So the SublimeREPL folder isn't in the User folder. So I created another path under User, as you described, and added the Main.sublime-menu file with those contents. But when I load Sublime afterwards, R is not even an option under SublimeREPL. 2) Rather than creating a new path as you mentioned, I just went and moved the SublimeREPL folder (that already has all the User/SublimeREPL/config stuff in it) into the "User" pathAjani
@MarcTulla - don't move, just copy.Notice
@MarcTulla I made a minor mistake in my answer, there won't be a separate R submenu, but you should have an Rterm option if you created User/SublimeREPL/config/R/Main.sublime-menu with the contents I gave you. Is that not showing up?Notice
Please join me in chat so we don't clutter the comments with troubleshooting...Notice
In more recent versions of R, maybe only 64bit builds, there is only R.exeDowson
B
0

I resolved this by adding the location of Rterm.exe to PATH

Budgerigar answered 24/6, 2018 at 23:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.