UBC-MDS / UBC-MDS.github.io

UBC MDS blog and academic site
https://ubc-mds.github.io
Other
14 stars 37 forks source link

Updating the Mac Installation Guide #224

Closed andytai7 closed 2 months ago

andytai7 commented 2 months ago
  1. When opening Jupyter Lab after installation, i got this error which did not allow me to terminate Jupyter lab from terminal
[W 2024-08-15 15:55:29.012 LabApp] Could not determine jupyterlab build status without nodejs
  1. For the Rstudio installation instructions I came across this error when following "For this instruction “Now we are going to change RStudio’s Insert Pipe shortcut so that it inserts the new native pipe operator |>. Go to Tools > Global Options > Code > Editing and tick the following option:”:

permission denied" macOS

Quoting from the link below, “ It's because Rstudio saves its preference in the ~.config folder which it do not have the permission to write. You can change the permission of .config folder to solve.” https://forum.posit.co/t/permission-denied-macos/123231

To fix this i ran this line of code in the terminal

sudo chown -R (whoami) .config

  1. Moving the Stan installation down but this has been done in the pull request already i believe.

  2. Finally running the post installation checks:

bash <(curl -Ss https://raw.githubusercontent.com/UBC-MDS/UBC-MDS.github.io/script-version-updates-2024-25/resources_pages/check-setup-mds.sh)


I get these missing programs:

Operating system
ProductName:        macOS
ProductVersion:     14.6.1
BuildVersion:       23G93

## System programs
OK        psql (PostgreSQL) 16.4
OK        rstudio 2024.04.2+764
OK        R 4.4.1 (2024-06-14) -- "Race for Your Life"
OK        python 3.12.2
OK        conda 4.7.1
OK        bash 3.2.57(1)-release (arm64-apple-darwin23)
OK        git 2.39.3 (Apple Git-146)
OK        make 3.81
OK        latex 3.141592653-2.6-1.40.26 (TeX Live 2024)
OK        tlmgr 5-24 09:30:36 +0200)
OK        docker 27.0.3, build 7d4bcd8
MISSING   code=1.*,
OK        quarto 1.5.56

## Python packages
OK        otter-grader=5.5.0
OK        pandas=2.2.2
OK        nbconvert-core=7.16.4
OK        playwright=1.46.0
OK        jupyterlab=4.2.4
OK        jupyterlab-git=0.50.1
OK        jupyterlab-spellchecker=0.8.4
OK        jupyterlab PDF-generation was successful.
OK        jupyterlab WebPDF-generation was successful.
OK        jupyterlab HTML-generation was successful.

## R packages
OK        tidyverse=2.0.0
OK        markdown=1.13
OK        rmarkdown=2.27
OK        renv=1.0.7
OK        IRkernel=1.3.2
OK        tinytex=0.52
OK        janitor=2.2.0
OK        gapminder=1.0.0
OK        readxl=1.4.3
OK        ottr=1.1.3
OK        canlang=0.0.1
MISSING   rmarkdown PDF-generation failed. Check that quarto, rmarkdown, and latex are marked OK above.
It seems that RMarkdown cannot find pandoc (should have been installed as part of quarto, check if 'quarto pandoc --version' works)
MISSING   rmarkdown HTML-generation failed. Check that quarto and rmarkdown are marked OK above.
It seems that RMarkdown cannot find pandoc (should have been installed as part of quarto, check if 'quarto pandoc --version' works)

The above output has been saved to the file /Users/andytai/check-setup-mds.log
together with system configuration details and any detailed error messages about PDF and HTML generation.
You can open this folder in your file browser by typing `open .` (without the surrounding backticks).
Before sharing the log file, review that there is no SENSITIVE INFORMATION such as passwords or access tokens in it.

Even though I have code installed, below shows check

(base) CPSC-M-21944:~ andytai$ code --version
1.92.2
fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
arm64
joelostblom commented 2 months ago

Great that you have gone through the instruction on Mac too Andy!

  1. That warning should not hinder you from terminating JupyterLab from terminal (I see it too when I don't have node installed). Try both Cmd +c and Ctrl +c on Mac.

  2. Technically students are told to only use machines where the have admin rights, but I'm ok adding this as a tip in a quoted box so that it is clear it is a parenthesis on applying to some people.

    image

    Shouldn't the command be the same as in the Latex section though, also setting the group permissions: sudo chown -R $(whoami):admin /usr/local/bin?

    image

  3. yup

  4. I fixed a typo so the VS code installation should be marked with OK now. For the Rmarkdown issue, can you troubleshoot the same way as for the other platforms and try to find the location where quarto (and pandoc) are installed on your mac. The script is looking in /Applications/RStudio.app/... and /opt/quarto... but maybe the location has changed on mac

andytai7 commented 2 months ago
  1. Sounds good

  2. This is the difference i think: Use the first command when you need to change ownership of your personal configuration files to yourself. Use the second command when you need to change ownership and set group permissions for a system directory like /usr/local/bin, ensuring that it is managed by the current user and the admin group.

Also the first command targets R so i think just using the second one wouldn't work?

I suggest adding this line into the PR for mac installation:

"For students that are having computer admin issues, please run this in the terminal sudo chown -R (whoami) .config"

  1. Thanks

  2. For pandoc, this is what i got.

(base) andytai@CPSC-M-21944 ~
$ Rscript -e "rmarkdown::find_pandoc(dir = c('/usr/lib/rstudio/resources/app/bin/quarto/bin/tools', 'C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools', '/Applications/RStudio.app/Contents/MacOS/quarto/bin/tools', '/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools'), cache=F); rmarkdown::render('mds-knit-pdf-test.Rmd', output_format = 'pdf_document')"
$version
[1] ‘0’

$dir
NULL

Error: pandoc version 1.12.3 or higher is required and was not found (see the help page ?rmarkdown::pandoc_available).
Execution halted

Quarto is located in

/usr/local/bin/quarto

joelostblom commented 2 months ago

2. Yup correct about the group but I was thinking that it makes sense to also change the group permission for the admin group. There is nothing special about R in the first command from what I can see and note that you will need $ to preface (whoami) for it be expanded into your username

4. Can you manually go looking for the Rstudio/quarto installation on your system? We will need the path to pandoc in the quarto installation. I don't want to use the path from /usr/local/bin even if pandoc might be there it could have been installed through any other means, so ideally we want to know where quarto/RStudio puts it on MacOS during installation. It's probably similar to one of the paths where are already looking in so start there.

andytai7 commented 2 months ago
  1. Okay so i am okay to add that line in the pr?

"For students that are having computer admin issues, please run this in the terminal sudo chown -R $(whoami) .config"

  1. i'm a bit confused here. I can't seem to find where quarto installed pandoc.

I did find pandoc in this location:

/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/rmarkdown/rmd/h/pandoc

I tested pandoc with quarto in rstudio, and it worked fine:

(base) andytai@CPSC-M-21944 ~
$ quarto render test.qmd --to html

processing file: test.qmd
1/5                  
2/5 [unnamed-chunk-1]
3/5                  
4/5 [unnamed-chunk-2]
5/5                  
output file: test.knit.md

pandoc 
  to: html
  output-file: test.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
joelostblom commented 2 months ago

2. Yes, formatted as a quote with >

4. Could you run which -a quarto? Does it return more than one path?

andytai7 commented 2 months ago
  1. so it would be formatted like this:

For students that are having computer admin issues, please run this in the terminal sudo chown -R $(whoami) .config

4.

(base) andytai@CPSC-M-21944 ~
$ which -a quarto
/usr/local/bin/quarto
/Applications/quarto/bin/quarto
joelostblom commented 2 months ago

2. Yup

4. Great! Is there a pandoc executable in something like /Applications/quarto/bin/tools/?

andytai7 commented 2 months ago

Yes i think here


(base) andytai@CPSC-M-21944 ~
$ /Applications/quarto/bin/tools/aarch64/pandoc ; exit;
joelostblom commented 2 months ago

Thanks! I think I found a more robust way to detect the pandoc path, could you try running the script again?

andytai7 commented 2 months ago

Checking program and package versions...

## Operating system
ProductName:        macOS
ProductVersion:     14.6.1
BuildVersion:       23G93

## System programs
OK        psql (PostgreSQL) 16.4
OK        rstudio 2024.04.2+764
OK        R 4.4.1 (2024-06-14) -- "Race for Your Life"
OK        python 3.12.2
OK        conda 4.7.1
OK        bash 3.2.57(1)-release (arm64-apple-darwin23)
OK        git 2.39.3 (Apple Git-146)
OK        make 3.81
OK        latex 3.141592653-2.6-1.40.26 (TeX Live 2024)
OK        tlmgr 5-24 09:30:36 +0200)
OK        docker 27.0.3, build 7d4bcd8
OK        code 1.92.2
OK        quarto 1.5.56

## Python packages
OK        otter-grader=5.5.0
OK        pandas=2.2.2
OK        nbconvert-core=7.16.4
OK        playwright=1.46.0
OK        jupyterlab=4.2.4
OK        jupyterlab-git=0.50.1
OK        jupyterlab-spellchecker=0.8.4
OK        jupyterlab PDF-generation was successful.
OK        jupyterlab WebPDF-generation was successful.
OK        jupyterlab HTML-generation was successful.

## R packages
OK        tidyverse=2.0.0
OK        markdown=1.13
OK        rmarkdown=2.27
OK        renv=1.0.7
OK        IRkernel=1.3.2
OK        tinytex=0.52
OK        janitor=2.2.0
OK        gapminder=1.0.0
OK        readxl=1.4.3
OK        ottr=1.1.3
OK        canlang=0.0.1
MISSING   rmarkdown PDF-generation failed. Check that quarto, rmarkdown, and latex are marked OK above, and that there is a pandoc executable in the following path: 
MISSING   rmarkdown HTML-generation failed. Check that quarto and rmarkdown are marked OK above and that there is a pandoc executable in the following path: 
joelostblom commented 2 months ago

Ugh can you run this from terminal:

echo "cat(dirname(paste(rmarkdown::pandoc_exec())))" > tmp-quarto-pandoc.R
quarto run tmp-quarto-pandoc.R
joelostblom commented 2 months ago

I'm guessing you will see no output from the command above, so I went back to my old solution plus added the path you gave me. Try running the script again, Ithink it willl work now.

andytai7 commented 2 months ago

Everything looks great!