rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.69k stars 1.1k forks source link

RStudio latest preview can not knit on Apple silicon MacBook - Bad CPU #12280

Closed gsgxnet closed 1 month ago

gsgxnet commented 2 years ago

System details

RStudio Edition :  Desktop
RStudio Version :  Version 2022.12.0-preview+308 (2022.12.0-preview+308)
OS Version      :  macOS Monterey 12.6 on M2 MacBook Air
R Version       :  4.2.1

Steps to reproduce the problem

Describe the problem in detail

render fails at start:

sh: /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc: Bad CPU type in executable
Error in strsplit(info, "\n")[[1]] : subscript out of bounds
Calls: <Anonymous> ... pandoc_available -> find_pandoc -> lapply -> FUN -> get_pandoc_version
In addition: Warning message:
In system(paste(shQuote(path), "--version"), intern = TRUE) :
  running command ''/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc' --version' had status 126
Execution halted

verification in shell: /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc --version
zsh: bad CPU type in executable: /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc

Describe the behavior you expected

render should produce a html document

ronblum commented 2 years ago

@gsgxnet Thank you for raising this! Do you know if this worked with earlier versions of the 2022.12.0 builds?

@jonvanausdeln Can you check if this works on the silicon MacOS? Though if it works on the M1, I'm concerned that a difference might be M1 vs. M2 (though I'd be surprised).

gsgxnet commented 2 years ago

@gsgxnet Thank you for raising this! Do you know if this worked with earlier versions of the 2022.12.0 builds?

@ronblum I had the same issue with the 2022.12.0 273 daily, dtd October, 18th. Before stating this issue I first wanted to make sure, it is still in the most current daily. Therefore I had installed the newer 308 preview. Any other daily you would suggest to try?

jonvanausdeln commented 2 years ago

@ronblum , works fine on my M1 machine. 2022.12.0-307

gsgxnet commented 2 years ago

May be my system behaves as it does because I do not have Rosetta installed here, pure arm64 Monterey.

Another probably connected issue - I can not create any quarto document on the same system: image Reproducible, just File -> New File -> Quarto Document

ronblum commented 2 years ago

@gsgxnet Did you by chance install a version of Quarto from https://quarto.org? If so, it takes precedence over the version that comes bundled with RStudio. If so, either

gsgxnet commented 2 years ago

@ronblum There is no quarto on this system from https://quarto.org/. I had installed the R quarto package after the problems I have reported here to find out if it might help. It does not, so removed that package again. Only quarto is the one contained in the RStudio:

sudo find / -name quarto -ls 2>&-                  
Password:
1518194        0 drwxr-xr-x    4 gsmaa            admin                 128 Nov  2 21:08 /System/Volumes/Data/Applications/RStudio.app/Contents/Resources/app/quarto
1518217       16 -rwxr-xr-x    1 gsmaa            admin                5556 Nov  2 14:33 /System/Volumes/Data/Applications/RStudio.app/Contents/Resources/app/quarto/bin/quarto
1520595        0 drwxr-xr-x    9 gsmaa            admin                 288 Nov  2 21:08 /System/Volumes/Data/Applications/RStudio.app/Contents/Resources/app/quarto/share/lua-types/quarto
1522588        0 drwxr-xr-x    5 gsmaa            admin                 160 Nov  2 21:08 /System/Volumes/Data/Applications/RStudio.app/Contents/Resources/app/quarto/share/extensions/quarto
1518194        0 drwxr-xr-x    4 gsmaa            admin                 128 Nov  2 21:08 /Applications/RStudio.app/Contents/Resources/app/quarto
1518217       16 -rwxr-xr-x    1 gsmaa            admin                5556 Nov  2 14:33 /Applications/RStudio.app/Contents/Resources/app/quarto/bin/quarto
1520595        0 drwxr-xr-x    9 gsmaa            admin                 288 Nov  2 21:08 /Applications/RStudio.app/Contents/Resources/app/quarto/share/lua-types/quarto
1522588        0 drwxr-xr-x    5 gsmaa            admin                 160 Nov  2 21:08 /Applications/RStudio.app/Contents/Resources/app/quarto/share/extensions/quarto

Same files are shown twice, I assume macOS sets some internal links.

I have no clue at all what is causing this.

gsgxnet commented 2 years ago

I checked with the file command:
file /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc
/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc: Mach-O 64-bit executable x86_64
this is definitely an Intel app, neither Universal nor Apple chips. This is the reason for the Bad CPU error I got. Are you sure you do deliver a fully Apple silicon RStudio app?
Anyhow I will try the most current daily now, may by the problem is already solved.


Checked with 316 preview Universal from your dailies download, same:

file /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc 
/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc: Mach-O 64-bit executable x86_64

So this is not an universal app.

For further info see:
https://apple.stackexchange.com/questions/429197/how-can-i-distinguish-arm-binaries-from-x86-binaries-on-macos

kevinushey commented 2 years ago

May be my system behaves as it does because I do not have Rosetta installed here, pure arm64 Monterey.

Is installing Rosetta an option for you?

gsgxnet commented 2 years ago

Is installing Rosetta an option for you?

@kevinushey - technically installing Rosetta could be a solution. But I prefer not to do so, because there seems to be no way to get totally rid of it later. And I prefer to avoid clutter if possible.

There is no real urgent need to get RStudio Univeral running on my new Apple Macbook. I still have an other option to use RStudio. I will patiently wait for a solution. Creating a fully Universal app seams not to be so easy, JetBrains has some X86 only components in their apps hiding in corners as well.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

gsgxnet commented 1 year ago

Retested on Version 2023.03.0+386. Still the same error when Rosetta is not installed.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

gsgxnet commented 1 year ago

Rechecked with current RStudio and also looking for a local Quarto install.
Both still need Rosetta2. I still hope in the not too distant future there will be an Apple Silicon native Quarto both from quarto.org and embedded in RStudio.
For Linux there is a ARM variant.

kevinushey commented 1 year ago

The next Quarto release should have arm64 builds available; hopefully that will come sometime in the new year.

leo-maxwell commented 8 months ago

I came across this problem and the solution is simple: you just download the latest pandoc arm64 version and overwrite the old one in the quarto folder inside the Rstudio app bundle. The knit worked just fine after this operation. Hope it will help everyone concerned about this problem. I found my laptop to have a much longer battery life after I removed Rosetta 2, and I do not want to install it again.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

github-actions[bot] commented 1 month ago

This issue has been automatically closed due to inactivity.