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

Can't get radian to start in Visual Studio Code: "The terminal process terminated with exit code: 1" #170

Closed
awellis opened this issue Mar 22, 2020 · 28 comments

Comments

@awellis
Copy link

awellis commented Mar 22, 2020

I have installed radian from Github

❯ radian --version                                                   13:48:38
radian version: 0.4.8
r executable: /Library/Frameworks/R.framework/Resources/bin/R
r version: 3.6.3
python executable: /Users/andrew/miniconda/bin/python
python version: 3.7.4

and removed all R arguments:

     "r.rterm.option": [],
    "r.rterm.mac": "/Users/andrew/miniconda/bin/radian"
    "r.alwaysUseActiveTerminal": true,
    "r.sessionWatcher": true,
    "r.lsp.use_stdio": true

This was working until I upgraded vscode insiders to the latest version yesterday. Now, I get the same error using the latest versions of both vscode and vscode insiders

@randy3k
Copy link
Owner

randy3k commented Mar 23, 2020

I have no issue with VScode 1.43.1 and radian 0.4.8.

@awellis
Copy link
Author

awellis commented Mar 23, 2020

This must be specific to my setup on MacOS, I haven't been able to reproduce this on Ubuntu either.

@awellis
Copy link
Author

awellis commented Mar 23, 2020

I have installed radian from Github

❯ radian --version                                                   13:48:38
radian version: 0.4.8
r executable: /Library/Frameworks/R.framework/Resources/bin/R
r version: 3.6.3
python executable: /Users/andrew/miniconda/bin/python
python version: 3.7.4

and removed all R arguments:

     "r.rterm.option": [],
    "r.rterm.mac": "/Users/andrew/miniconda/bin/radian"
    "r.alwaysUseActiveTerminal": true,
    "r.sessionWatcher": true,
    "r.lsp.use_stdio": true

This was working until I upgraded vscode insiders to the latest version yesterday. Now, I get the same error using the latest versions of both vscode and vscode insiders

Do you have any idea how to get the log file from VSCode?

Can't find anything, even when starting code-insiders --log trace

@awellis
Copy link
Author

awellis commented Mar 23, 2020

A also have no problem starting radian at the command line, this only occurs in VScode

@awellis
Copy link
Author

awellis commented Mar 23, 2020

So far I've figured that my problem is related to my python installation (miniconda). I am able to recreate the issue in a new user account, by installing miniconda, and then selecting the python interpreter in VSCode

I get the following error:

Screen Shot 2020-03-23 at 12 58 47

@awellis
Copy link
Author

awellis commented Mar 24, 2020

I have tried to reinstall radian, using python installed with miniconda. Since pip install git+https://github.com/randy3k/radian using the miniconda version of pip does not work on MacOS (it works on my Manjaro machine), I installed radian using python setup.py install from the source directory.

I now get the following:

❯ radian                                                                                       
Traceback (most recent call last):
  File "/Users/andrew/miniconda/bin/radian", line 11, in <module>
    load_entry_point('radian', 'console_scripts', 'radian')()
  File "/Users/andrew/src/radian/radian/__init__.py", line 96, in main
    RadianApplication(r_home, ver=__version__).run(options)
  File "/Users/andrew/src/radian/radian/radianapp.py", line 89, in run
    rchitect.init(args=args)
  File "/Users/andrew/miniconda/lib/python3.7/site-packages/rchitect-0.3.19-py3.7-macosx-10.9-x86_64.egg/rchitect/setup.py", line 27, in init
    if not lib._libR_load(libRpath(rhome).encode("utf-8")):
  File "/Users/andrew/miniconda/lib/python3.7/site-packages/rchitect-0.3.19-py3.7-macosx-10.9-x86_64.egg/rchitect/utils.py", line 56, in libRpath
    raise RuntimeError("Cannot locate R share library.")
RuntimeError: Cannot locate R share library.

Does anyone have any experience installing radian on MacOS?

@randy3k
Copy link
Owner

randy3k commented Mar 24, 2020

Did you install R? Or how did you install if?

@awellis
Copy link
Author

awellis commented Mar 24, 2020

I installed the Framework version of R, i.e. using the installer from CRAN.

❯ which R                                                                                                                                                                                               20:19:51
/usr/local/bin/R
❯ ll /usr/local/bin/R*                                                                                                                                                                                  20:19:49
lrwxr-xr-x  1 root  wheel    47B 24 Mar 13:12 /usr/local/bin/R -> /Library/Frameworks/R.framework/Resources/bin/R
lrwxr-xr-x  1 root  wheel    53B 24 Mar 13:12 /usr/local/bin/Rscript -> /Library/Frameworks/R.framework/Resources/bin/Rscript

@awellis
Copy link
Author

awellis commented Mar 24, 2020

my R_HOME environment variable is set to:

❯ echo $R_HOME                                                                                                                                                                                          20:24:32
/Library/Frameworks/R.framework/Resources/

@randy3k
Copy link
Owner

randy3k commented Mar 24, 2020

You got the error Cannot locate R share library.. Does the file /Library/Frameworks/R.framework/Resources/lib/libR.dylib exist?

@awellis
Copy link
Author

awellis commented Mar 24, 2020

yes.

R.framework/Resources/lib
❯ ll                                                                                                                                                                                                    21:44:18
.rwxrwxr-x 874k root  6 Mar  3:06 libc++.1.dylib
.rwxrwxr-x 237k root  6 Mar  3:06 libc++abi.1.dylib
.rwxrwxr-x 317k root  6 Mar  3:06 libgcc_s.1.dylib
.rwxrwxr-x 1.6M root  6 Mar  3:06 libgfortran.3.dylib
.rwxrwxr-x 610k root  6 Mar  3:06 libomp.dylib
.rwxrwxr-x 304k root  6 Mar  3:06 libquadmath.0.dylib
.rwxrwxr-x 3.7M root  6 Mar  3:06 libR.dylib
drwxrwxr-x    - root 26 Apr  2019 libR.dylib.dSYM
.rwxrwxr-x 210k root  6 Mar  3:06 libRblas.0.dylib
lrwxr-xr-x   16 root 24 Mar 13:11 libRblas.dylib -> libRblas.0.dylib
drwxrwxr-x    - root 26 Apr  2019 libRblas.dylib.dSYM
.rwxrwxr-x 1.1M root  6 Mar  3:06 libreadline.5.2.dylib
lrwxr-xr-x   21 root 24 Mar 13:11 libreadline.dylib -> libreadline.5.2.dylib
.rwxrwxr-x 2.2M root  6 Mar  3:06 libRlapack.dylib
drwxrwxr-x    - root 26 Apr  2019 libRlapack.dylib.dSYM
.rwxrwxr-x  86k root  6 Mar  3:06 libunwind.1.dylib

@randy3k
Copy link
Owner

randy3k commented Mar 24, 2020

That's odd. Just want to make sure the correct R_HOME was detected.

(randyimac)-~$ python -c 'import rchitect; print(rchitect.utils.Rhome())'
/Library/Frameworks/R.framework/Resources

@awellis
Copy link
Author

awellis commented Mar 25, 2020

I get the same, i.e. /Library/Frameworks/R.framework/Resources

@randy3k
Copy link
Owner

randy3k commented Mar 25, 2020

If R_HOME is /Library/Frameworks/R.framework/Resources and
/Library/Frameworks/R.framework/Resources/lib/libR.dylib exists, it is impossible that Cannot locate R share library.

cf: https://github.com/randy3k/rchitect/blob/master/rchitect/utils.py#L42

@awellis
Copy link
Author

awellis commented Mar 25, 2020

Well, I can start radian in a console:

❯ which radian                                                                                                                                                                                          
/Users/andrew/miniconda/bin//radian

~
❯ radian --version                                                                                                                                                                                      
radian version: 0.4.8
r executable: /Library/Frameworks/R.framework/Resources/bin/R
r version: 1000.0.0
python executable: /Users/andrew/miniconda/bin/python
python version: 3.7.4

The problem is that I can't start radian from Visual Studio Code. Here are my VSCode settings:

{
    "vscode-neovim.neovimPath": "/usr/local/bin/nvim",
    "workbench.iconTheme": "vscode-icons-mac",
    "workbench.startupEditor": "newUntitledFile",
    "terminal.external.osxExec": "iTerm2.app",
    "workbench.colorTheme": "Nord",
    "files.autoSave": "onFocusChange",
    "editor.fontFamily": "Fira Code, Cascadia Code, Hasklig",
    "editor.fontLigatures": true,
    "editor.minimap.enabled": false,
    "search.showLineNumbers": true,
    "julia.executablePath": "/usr/local/bin/julia",
    "julia.lint.call": true,
    "julia.enableCrashReporter": true,
    "julia.enableTelemetry": true,
    "julia.NumThreads": 8,
    "window.restoreFullscreen": true,
    "window.zoomLevel": 0,
    // "todo-tree.general.tags": [
    //     "TODO",
    //     "FIXME",
    //     "HACK"
    // ],
    "editor.tabCompletion": "on",
    "todo.archive.sortByDate": true,
    "todo.timekeeping.created.enabled": true,
    "rewrap.autoWrap.enabled": false,
    "rewrap.reformat": true,
    "terminal.integrated.experimentalRefreshOnResume": true,
    "terminal.integrated.experimentalUseTitleEvent": true,
    "terminal.integrated.fontSize": 13,
    "debug.console.fontFamily": "'Fira Code'",
    "markdown.extension.preview.autoShowPreviewToSide": true,
    "juliaFormatter.whitespace_typedefs": true,
    "color-highlight.matchWords": true,
    "debug.console.fontSize": 13,
    "rewrap.wrappingColumn": 60,
    "git.alwaysShowStagedChangesResourceGroup": true,
    "editor.fontSize": 13,
    "python.insidersChannel": "off",
    "explorer.confirmDelete": false,
    "terminal.integrated.inheritEnv": false,
    "git.autofetch": true,
    "gitlens.advanced.messages": {
        "suppressCommitNotFoundWarning": true
    },
    "editor.renderControlCharacters": true,
    "latex-workshop.intellisense.unimathsymbols.enabled": true,
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.synctex.afterBuild.enabled": true,
    "latex-workshop.synctex.synctexjs.enabled": false,
    "indentRainbow.colors": [
        "rgba(129,161,193,0.1)",
        "rgba(76,86,106,0.2)",
        "rgba(180,142,173,0.1)",
        "rgba(216,222,233,0.1)",
        "rgba(rgba(97,145,191,0.4))"
    ],
    "indentRainbow.errorColor": "rgba(191,97,106,0.6)",
    "cSpell.enableFiletypes": [
        "juliamarkdown"
    ],
    // "r.lsp.path": "/Library/Frameworks/R.framework/Resources/bin/R",
    // "python.condaPath": "~/andrew/miniconda/bin",
    "terminal.integrated.macOptionIsMeta": true,
    "http.proxySupport": "off",
    "r.rterm.mac": "/Users/andrew/miniconda/bin/radian",
    "r.rterm.option": [],
    "r.sessionWatcher": true,
    "r.bracketedPaste": true,
    "r.alwaysUseActiveTerminal": true

@randy3k
Copy link
Owner

randy3k commented Mar 25, 2020

r version: 1000.0.0 So there is an issue in detecting R version.

What does /Library/Frameworks/R.framework/Resources/bin/R --version gives you?

@awellis
Copy link
Author

awellis commented Mar 25, 2020

❯ /Library/Frameworks/R.framework/Resources/bin/R --version                                                                                                                                             10:30:05
WARNING: ignoring environment value of R_HOME
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

@randy3k
Copy link
Owner

randy3k commented Mar 25, 2020

Ok, so it is just a false alarm. If I have to guess, there may be a PATH related issue in your vscode setup.

@randy3k
Copy link
Owner

randy3k commented Mar 25, 2020

We actually see that warning when the environmental variable R_HOME is different from R RHOME. Did you set R_HOME incorrectly?

@awellis
Copy link
Author

awellis commented Mar 25, 2020

So, after hours of frustration, I've finally managed to find the source of this. In some way or other I had managed to set the VSCode setting"terminal.integrated.inheritEnv" to false. This should of course be true, and then everything works as expected.

"terminal.integrated.inheritEnv": true

Sorry for all the bother.

There is one more thing, though. How do you get radian installed using pip and Miniconda/Anaconda on MacOS? This does not work for me, I had to install using python setup.py install.

@awellis
Copy link
Author

awellis commented Mar 25, 2020

I can of course close this issue and open a new one if this is relevant.

And thanks for your help, by the way 👏🏼

@randy3k
Copy link
Owner

randy3k commented Mar 25, 2020

What does it mean when you say pip didn’t work?

@awellis
Copy link
Author

awellis commented Mar 25, 2020

❯ pip install git+https://github.com/randy3k/radian                                                                                                                                                     12:26:19
Traceback (most recent call last):
  File "/Users/andrew/miniconda/bin/pip", line 7, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal.cli.main'

@randy3k
Copy link
Owner

randy3k commented Mar 25, 2020

It seems that it’s an issue of your miniconda setup. Try reinstalling pip or miniconda.

@randy3k randy3k closed this as completed Mar 25, 2020
@randy3k
Copy link
Owner

randy3k commented Mar 25, 2020

Closing it now as the issue is not caused by radian

@D3SL
Copy link

D3SL commented Apr 16, 2020

Slight necropost but I ran into this same issue on Windows 10 because I ran pip install radian from CMD and not from the anaconda prompt. Installing via pip from inside the anaconda prompt and using the copy of radian that produced fixed everything.

@mbannert
Copy link

mbannert commented Oct 8, 2021

@awellis : Thanks so much.. I had the same issue terminal.integrated.inheritEnv but had no clue this setting existed, let alone what it meant. The reason why I post here, is that I think I know what caused setting the switch to false for me:
Updated VS Code from 1.4.something to 1.61.0 . After the update radian wasn't running anymore precisely b/c of that flag.

@mubeenkhan94
Copy link

@awellis : Thanks so much.. I had the same issue terminal.integrated.inheritEnv but had no clue this setting existed, let alone what it meant. The reason why I post here, is that I think I know what caused setting the switch to false for me: Updated VS Code from 1.4.something to 1.61.0 . After the update radian wasn't running anymore precisely b/c of that flag.

Thank you, you fixed my issue!

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

5 participants