blob: 4b46223ff138f05e814fcbab06423f348157ed9c [file] [log] [blame]
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="A low-level description of arrow installation intended for developers
">
<title>Installation details • Arrow R Package</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../../favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="../../favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../../apple-touch-icon.png">
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../../apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../../apple-touch-icon-60x60.png">
<script src="../../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="../../deps/bootstrap-5.2.2/bootstrap.min.css" rel="stylesheet">
<script src="../../deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../../pkgdown.js"></script><meta property="og:title" content="Installation details">
<meta property="og:description" content="A low-level description of arrow installation intended for developers
">
<meta property="og:image" content="https://arrow.apache.org/img/arrow-logo_horizontal_black-txt_white-bg.png">
<meta property="og:image:alt" content="Apache Arrow logo, displaying the triple chevron image adjacent to the text">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:creator" content="@apachearrow">
<meta name="twitter:site" content="@apachearrow">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--><!-- Matomo --><script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
/* We explicitly disable cookie tracking to avoid privacy issues */
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.apache.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '20']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script><!-- End Matomo Code -->
</head>
<body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar fixed-top navbar-dark navbar-expand-lg bg-black"><div class="container">
<a class="navbar-brand me-2" href="../../index.html">Arrow R Package</a>
<span class="version">
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">13.0.0</small>
</span>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link" href="../../articles/arrow.html">Get started</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../reference/index.html">Reference</a>
</li>
<li class="active nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-articles">Articles</a>
<div class="dropdown-menu" aria-labelledby="dropdown-articles">
<h6 class="dropdown-header" data-toc-skip>Using the package</h6>
<a class="dropdown-item" href="../../articles/read_write.html">Reading and writing data files</a>
<a class="dropdown-item" href="../../articles/data_wrangling.html">Data analysis with dplyr syntax</a>
<a class="dropdown-item" href="../../articles/dataset.html">Working with multi-file data sets</a>
<a class="dropdown-item" href="../../articles/python.html">Integrating Arrow, Python, and R</a>
<a class="dropdown-item" href="../../articles/fs.html">Using cloud storage (S3, GCS)</a>
<a class="dropdown-item" href="../../articles/flight.html">Connecting to a Flight server</a>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header" data-toc-skip>Arrow concepts</h6>
<a class="dropdown-item" href="../../articles/data_objects.html">Data objects</a>
<a class="dropdown-item" href="../../articles/data_types.html">Data types</a>
<a class="dropdown-item" href="../../articles/metadata.html">Metadata</a>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header" data-toc-skip>Installation</h6>
<a class="dropdown-item" href="../../articles/install.html">Installing on Linux</a>
<a class="dropdown-item" href="../../articles/install_nightly.html">Installing development versions</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="../../articles/index.html">More articles...</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../../news/index.html">Changelog</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0" role="search">
<input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../../search.json" id="search-input" placeholder="Search for" autocomplete="off">
</form>
<ul class="navbar-nav">
<li class="nav-item">
<a class="external-link nav-link" href="https://github.com/apache/arrow/" aria-label="github">
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
</div>
</nav><div class="container template-article">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="" class="logo" alt=""><h1>Installation details</h1>
<small class="dont-index">Source: <a href="https://github.com/apache/arrow/blob/main/r/vignettes/developers/install_details.Rmd" class="external-link"><code>vignettes/developers/install_details.Rmd</code></a></small>
<div class="d-none name"><code>install_details.Rmd</code></div>
</div>
<p>This document is intended specifically for arrow <em>developers</em> who wish to know more about these scripts. If you are an arrow <em>user</em> looking for help with installing arrow, please see <a href="../install.html">the installation guide</a></p>
<p>The arrow R package requires that Arrow C++ library (also known as libarrow) to be installed in order to work properly. There are a number of different ways in which libarrow could be installed:</p>
<ul>
<li>as part of the R package installation process</li>
<li>a system package</li>
<li>a library you’ve built yourself outside of the context of installing the R package</li>
</ul>
<p>Below, we discuss each of these setups in turn.</p>
<div class="section level2">
<h2 id="installing-libarrow-during-r-package-installation">Installing libarrow during R package installation<a class="anchor" aria-label="anchor" href="#installing-libarrow-during-r-package-installation"></a>
</h2>
<p>There are a number of scripts that are triggered when <code>R CMD INSTALL .</code> is run and for Arrow users, these should all just work without configuration and pull in the most complete pieces (e.g. official binaries that we host). One of the jobs of these scripts is to work out if libarrow is installed, and if not, install it.</p>
<p>An overview of these scripts is shown below:</p>
<ul>
<li><p><code>configure</code> and <code>configure.win</code> - these scripts are triggered during <code>R CMD INSTALL .</code> on non-Windows and Windows platforms, respectively. They handle finding the libarrow, setting up the build variables necessary, and writing the package Makevars file that is used to compile the C++ code in the R package.</p></li>
<li><p><code>tools/nixlibs.R</code> - this script is called by <code>configure</code> on Linux (or on any non-windows OS with the environment variable <code>FORCE_BUNDLED_BUILD=true</code>) if an existing libarrow installation cannot be found. This sets up the build process for our bundled builds (which is the default on linux) and checks for binaries or downloads libarrow from source depending on dependency availability and build configuration.</p></li>
<li><p><code>tools/winlibs.R</code> - this script is called by <code>configure.win</code> on Windows when environment variable <code>ARROW_HOME</code> is not set. It looks for an existing libarrow installation, and if it can’t find one downloads an appropriate libarrow binary.</p></li>
<li><p><code>inst/build_arrow_static.sh</code> - called by <code>tools/nixlibs.R</code> when libarrow<br>
needs to be built. It builds libarrow for a bundled, static build, and mirrors the steps described in the <a href="./setup.html">Arrow R developer guide</a> This build script is also what is used to generate our prebuilt binaries.</p></li>
</ul>
<p>The actions taken by these scripts to resolve dependencies and install the correct components are described below.</p>
<div class="section level3">
<h3 id="how-the-r-package-finds-libarrow">How the R package finds libarrow<a class="anchor" aria-label="anchor" href="#how-the-r-package-finds-libarrow"></a>
</h3>
<div class="section level4">
<h4 id="windows">Windows<a class="anchor" aria-label="anchor" href="#windows"></a>
</h4>
<p>The diagram below shows how the R package finds a libarrow installation on Windows.</p>
<p><img src="install_diagram_windows.png" alt="Flowchart of libarrow installation on Windows systems - find full descriptions in sections 'Checking for existing libarrow installations' and 'Downloading libarrow' below" width="70%"></p>
<div class="section level5">
<h5 id="checking-for-existing-libarrow-installations">Checking for existing libarrow installations<a class="anchor" aria-label="anchor" href="#checking-for-existing-libarrow-installations"></a>
</h5>
<p>When you install the arrow R package on Windows, if the <code>ARROW_HOME</code> environment variable has not been set, the install script looks for an existing libarrow installation. If this cannot be find, it then checks whether the <code>R_WINLIB_LOCAL</code> environment variable has been set to point to a local installation.</p>
</div>
<div class="section level5">
<h5 id="downloading-libarrow">Downloading libarrow<a class="anchor" aria-label="anchor" href="#downloading-libarrow"></a>
</h5>
<p>If no existing libarrow installations can be found, the script proceeds to try to download the required version of libarrow, first from the nightly builds repository and then from Rwinlib. The script first tries to find a version of libarrow which is matches the most components according to semantic versioning, and in the case of a failure becomes less specific (i.e. if there are no binaries found for version 0.14.1.1, then try to find one for 0.14.1).</p>
</div>
</div>
<div class="section level4">
<h4 id="non-windows">Non-Windows<a class="anchor" aria-label="anchor" href="#non-windows"></a>
</h4>
<p>On Linux and macOS, the core logic is:</p>
<ol style="list-style-type: decimal">
<li>If <code>FORCE_BUNDLED_BUILD=true</code>, skip to step 3.</li>
<li>Find libarrow on the system. If it is present, make sure that its version is compatible with the R package.</li>
<li>If no suitable libarrow is found, download it (where allowed) or build it from source.</li>
<li>Determine what features this libarrow has and what other flags it requires, and set them in <code>src/Makevars</code> for use when compiling the bindings.</li>
</ol>
<div class="section level5">
<h5 id="finding-libarrow-on-the-system">Finding libarrow on the system<a class="anchor" aria-label="anchor" href="#finding-libarrow-on-the-system"></a>
</h5>
<p>The <code>configure</code> script will look for libarrow in three places:</p>
<ol style="list-style-type: decimal">
<li>The path in environment variable <code>ARROW_HOME</code>, if set</li>
<li>Whatever <code>pkg-config</code> finds, unless <code>ARROW_USE_PKG_CONFIG=false</code>
</li>
<li>Homebrew, if you have done <code>brew install apache-arrow</code>
</li>
</ol>
<p>If a libarrow build is found, it will then check that the version of that C++ library matches that of the R package. If the versions do not match, like when you’ve installed a system package for a release version but you have a development version of the R package, that libarrow will not be used. If both the C++ library and R package are on development versions, you will see a warning message advising you that if you do have trouble, you should ensure that the C++ library was built from the same commit as the R package, as development version numbers do not change with every commit.</p>
</div>
<div class="section level5">
<h5 id="prebuilt-binaries">Prebuilt binaries<a class="anchor" aria-label="anchor" href="#prebuilt-binaries"></a>
</h5>
<p>If libarrow is not found on the system, the R package installation script will next attempt to download prebuilt libarrow binaries that match your both your local operating system, required dependencies (e.g. openssl version) and arrow R package version.</p>
<p>These are used automatically on many Linux distributions (x86_64 architecture only), according to the <a href="https://github.com/apache/arrow/blob/main/r/tools/nixlibs-allowlist.txt" class="external-link">allowlist</a>. If your distribution isn’t in the list, you can opt-in by setting the <code>NOT_CRAN</code> environment variable before you call <code><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages()</a></code>. If found, they will be downloaded and bundled when your R package compiles.</p>
</div>
<div class="section level5">
<h5 id="building-from-source">Building from source<a class="anchor" aria-label="anchor" href="#building-from-source"></a>
</h5>
<p>If no suitable libarrow binary is found, it will attempt to build it locally. First, it will also look to see if you are in a checkout of the <code>apache/arrow</code> git repository and thus have the libarrow source files there. Otherwise, it builds from the source files included in the package. Depending on your system, building libarrow from source may be slow. If libarrow is built from source, <code>inst/build_arrow_static.sh</code> is executed.</p>
</div>
</div>
</div>
</div>
<div class="section level2">
<h2 id="using-the-r-package-with-libarrow-installed-as-a-system-package">Using the R package with libarrow installed as a system package<a class="anchor" aria-label="anchor" href="#using-the-r-package-with-libarrow-installed-as-a-system-package"></a>
</h2>
<p>If you are authorized to install system packages and you’re installing a CRAN release, you may want to use the official Apache Arrow release packages corresponding to the R package version via software distribution tools such as <code>apt</code> or <code>yum</code> (though there are some drawbacks: see the <a href="../install.html#troubleshooting">“Troubleshooting” section in the main installation docs</a>). See the <a href="https://arrow.apache.org/install/" class="external-link">Arrow project installation page</a> to find pre-compiled binary packages for some common Linux distributions, including Debian, Ubuntu, and CentOS.</p>
<p>If you are a developer contributing to the R package, system libarrow packages won’t be useful because the versions will not match.</p>
</div>
<div class="section level2">
<h2 id="using-the-r-package-with-an-existing-libarrow-build">Using the R package with an existing libarrow build<a class="anchor" aria-label="anchor" href="#using-the-r-package-with-an-existing-libarrow-build"></a>
</h2>
<p>This setup is much more common for arrow developers, who may be needing to make changes to both the R package and libarrow source code. See the <a href="./setup.html">developer setup docs</a> for more information.</p>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
</nav></aside>
</div>
<footer><div class="pkgdown-footer-left">
<p></p>
<p><a href="https://arrow.apache.org/docs/r/versions.html">Older versions of these docs</a></p>
</div>
<div class="pkgdown-footer-right">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer>
</div>
</body>
</html>