randy3k / radian

A 21 century R console
MIT License
2k stars 76 forks source link

[MacOS] Cannot get Radian terminal to run in VSCode #400

Open itsmevictor opened 1 year ago

itsmevictor commented 1 year ago

Hi,

I am trying to set up Radian in VSC. When I try to launch the R terminal, I get the following error message: The terminal process "/Users/victor/opt/anaconda3/bin/radian" terminated with exit code: 1.

My settings are the following:

"terminal.integrated.inheritEnv": true,
"r.bracketedPaste": true,
"r.rterm.mac": "/Users/victor/opt/anaconda3/bin/radian",
"r.rterm.option": [],
"r.plot.useHttpgd": true

When

Further,

EDIT: For additional information, when running radian in terminal, I get:

  File "/Users/victorkreitmann/opt/anaconda3/bin/radian", line 8, in <module>
    sys.exit(main())
  File "/Users/victorkreitmann/opt/anaconda3/lib/python3.9/site-packages/radian/app.py", line 108, in main
    RadianApplication(r_home, ver=__version__).run(options, cleanup=cleanup)
  File "/Users/victorkreitmann/opt/anaconda3/lib/python3.9/site-packages/radian/app.py", line 205, in run
    rchitect.init(args=args, register_signal_handlers=True)
  File "/Users/victorkreitmann/opt/anaconda3/lib/python3.9/site-packages/rchitect/setup.py", line 49, in init
    raise Exception(load_lib_error())
Exception: Cannot load shared library: dlopen(/Library/Frameworks/R.framework/Resources/lib/libR.dylib, 0x000A): tried: '/Library/Frameworks/R.framework/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/R.framework/Resources/lib/libR.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libR.dylib' (no such file), '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

I assume this is part of the problem, but I am having trouble figuring exactly why.

zaneeto commented 1 year ago

Hi, I have a similar issue #402. When I run radian in terminal, I don't get any error messages but there is no output either. From what I'm reading it could be to do with conda. Hopefully someone figures this out.

zaneeto commented 1 year ago

Hi, I managed to resolve it by completely removing all conda-related files from my computer. Given I see you are using anaconda3 as well, I suspect it may be caused by interaction with conda/the installation directories. Could you try running it outside your conda environment to see if it works?

Betristor commented 1 year ago

@ItsMeVictor i have encountered this problem also. The integrated shell will break after startup. But if I don't use radian and use original R, the R session could be opened properly.

randy3k commented 1 year ago

It is the issue of mixing arm and x64 binaries. Make sure both R and python have the same architecture. Prefer both to be arm based.

Betristor commented 1 year ago

Emmm, I'm very sure about that architecture of python is arm64 since I used homebrew to manage all python related environment. And my conda is also arm64, since my R is arm64 with R version 4.2.3 (2023-03-15) -- "Shortstop Beagle" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: aarch64-apple-darwin20 (64-bit), will the problem be with the python it used?

Betristor commented 1 year ago

I managed to captured the error vscode reported. (I updated the radian using a newer version python.)

image

It said that Rhome could not be found, how should set this environment variable? I browsered that #373 also mentioned something like this only it's a windows machine.

randy3k commented 1 year ago

What error message did you get?

Betristor commented 1 year ago

VSC just prompted a message that the shell could not start properly. But the error underneath is as shown in my snapshot.

randy3k commented 1 year ago

Your issue is different from OP. Please see README on how to specific path to R binary.

MaxforCherubim commented 5 months ago

I meet the same problem. According to your discussion, I recognize that it need to set option aim to the R binary !!! "r.rterm.option": ["--r-binary=/usr/local/bin/R"] It works!