December 9, 2022

747 words 4 mins read

Installing Quarto-CLI on Linux-arm64 systems

Installing Quarto-CLI on Linux-arm64 systems

UPDATE:

This article is no longer relevant since the availability of official Quarto arm64 builds. Installation is pretty simple now:

# Download deb installer
wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.433/quarto-1.3.433-linux-arm64.deb
# Install Quarto
sudo dpkg -i quarto-1.3.433-linux-arm64.deb

I’ll leave the old article down below for reference.


Quarto is Posit’s new open-source scientific and technical publishing system built on Pandoc that allows you to weave together narrative text and code to produce high-quality outputs including reports, presentations, websites, and more. It’s the successor of the highly successful, but R specific, R Markdown ecosystem, bringing all the benefits of R Markdown to other programming langues like Python, Julia and Observable.

Unfortunately, because of the lack of official arm64 binary sources for some of its dependencies (e.g. Deno, SASS, Pandoc), and as explained to me, their limited bandwidth to support not sufficiently popular architectures like Linux arm64. Quarto does not officially support the arm64 architecture, but that doesn’t mean we can’t make it work on it ourselves.

With the kind help of Carlos Scheidegger (@scheidegger@mastodon.social), a software engineer at Posit working on Quarto, I have managed to hack my way into installing Quarto on arm64 systems, and I’ll like to share how I did it with the R community.

Testing Platform

I have tried this on Raspberry Pi 3B+ and 4B running Raspberry Pi OS and Ubuntu 22.04 LT, and on an Oracle Ampere Altra VM running Ubuntu 22.04 LTS, so I’m pretty sure this should work on any arm64 system, provided that you can get suitable arm64 versions of Quarto’s dependencies on your specific Linux distribution. In all cases, I started with a clean and up-to-date install of the operating system so make sure you update yours as well before you start.

sudo apt update
sudo apt dist-upgrade

Installing Dependencies

First, we need a sufficiently modern arm64 version of Pandoc, and since the version that comes with the standard deb repositories for your OS is most likely too old, it is better if we download a modern version ourselves (this is very important since Quarto will fail with older Pandoc versions).

wget https://github.com/jgm/pandoc/releases/download/2.19.2/pandoc-2.19.2-1-arm64.deb
sudo dpkg -i pandoc-2.19.2-1-arm64.deb
rm pandoc-2.19.2-1-arm64.deb

Also, we need R and the rmarkdown R package, but since you are reading this article on an R related blog, I will assume you already have R installed in your system and you know how to install R packages, if you don’t, you can check this other post where I detail options to install R on a Pi. To clarify, I’m considering R as a dependency because I’m writing on an R related blog, but if you are going to use Quarto with some other programming language, R is not mandatory.

Installing Quarto

Since there are no arm64 binaries for Quarto, we are going to install it from source. Follow these steps from top to bottom without skipping any since they all depend on the previous one:

First, we need to clone the GitHub repository in a suitable location. Note that you can optionally clone a specific release version if you prefer by using the --branch option (e.g. --branch v1.3.47)

sudo su -

cd /usr/local/src

git clone --depth 1 https://github.com/quarto-dev/quarto-cli

cd quarto-cli

Next, we are going to trick Quarto into installing an arm64 version of Deno from an alternative source by modifying its configure.sh file before executing it.

sed -i 's/https:\/\/github.com\/denoland\/deno\/releases\/download/https:\/\/github.com\/LukeChannings\/deno-arm64\/releases\/download/' configure.sh
sed -i 's/DENOFILES=deno-x86_64-unknown-linux-gnu.zip/DENOFILES=deno-linux-arm64.zip/' package/scripts/common/utils.sh
sed -i 's/DENO_DIR=deno-x86_64-unknown-linux-gnu/DENO_DIR=deno-linux-arm64/' package/scripts/common/utils.sh

./configure.sh

Finally, we are going to replace the external amd64 binaries Quarto downloads during installation with arm64 ones.

mkdir package/dist/bin/tools/deno-x86_64-unknown-linux-gnu/
ln -s /usr/local/src/quarto-cli/package/dist/bin/tools/deno-linux-arm64/deno package/dist/bin/tools/deno-x86_64-unknown-linux-gnu/deno

rm package/dist/bin/tools/pandoc
ln -s /usr/bin/pandoc package/dist/bin/tools/pandoc

rm -rf package/dist/bin/tools/dart-sass/
wget https://github.com/sass/dart-sass/releases/download/1.57.1/dart-sass-1.57.1-linux-arm64.tar.gz
tar zxvf dart-sass-1.57.1-linux-arm64.tar.gz
rm dart-sass-1.57.1-linux-arm64.tar.gz
mv -f dart-sass/ package/dist/bin/tools/

If all went well, you now have a working installation of the Quarto Command Line Interface in your system, and you can start rendering qmd files from the terminal. To test if it actually works, let’s render a test document; create a test.qmd file with the following content:

---
title: "Test Document"
format: html
---

## Hello

```{r}
print("world")
```

And render the document from a system terminal with the following command:

quarto render test.qmd

If all goes well, you will get a test.html file in the current location.

I haven’t figured out how to enable the RStudio IDE integration with Quarto (RStudio’s experimental builds for arm64 come with Quarto integration features disabled). I have raised the question on the GitHub repository, and I’ll update this post if a solution or workaround arises.

Edit this page
comments powered by Disqus