How to Build a Custom Anaconda Installer for R

 

Abstract package background

A frequent question on the Anaconda Community mailing list is how to package R with conda for distribution. Depending on the use case, one option may be to use conda to move environments. This requires that conda has been previously installed on the system. Another option is conda constructor, a utility for packaging a complete conda installation with Python and R packages.

Constructor is the same utility we use to build Anaconda Distribution and Miniconda installers. It’s a multi-platform installer which means you can build an installer for Windows, Linux and macOS. It also supports a number of options to control how the installer is built. These options are documented on the GitHub constructor repository.

Installing Constructor

Constructor v3.0 requires conda 4.7.10 or higher. Check the version of conda and update if needed.

 
(base)$ conda --version
Conda 4.7.5
(base)$ conda upgrade conda

Install constructor and check the version:

(base)$ conda install constructor
(base) $ constructor --version
constructor 3.0.0

Constructor Basics

Constructor uses a YAML file to configure the build. The default file name for the configuration file is construct.yaml. The only mandatory elements are the name and version, but to create an environment you will also need to specify the channels and the packages to be installed. This is an example file that creates an installer with just python and conda:

 
name: myBase
version: 0.1

channels:
  - https://repo.anaconda.com/pkgs/main/
specs:
  - python
  - conda

To build this installer

 
(base)$ constructor .

If you run this command in macOS, constructor will create an installer named myBase-0.1-MacOSX-x86_64.sh.
By default, the installer uses name-version-OS as the naming convention when a name is not specified.

If you want to create a .pkg installer named myBase_Belong_To_Us, add the installer_type and installer_filename keys to the construct.yaml file:

 
installer_filename: myBase_Belong_To_Us.pkg
installer_type: pkg  [osx]

The keys available to customize the installer are listed on the constructor GitHub repository.

Custom R Installer Tutorial

The R installer tutorial covers how to build installers for Windows, Linux and macOS. The tutorial includes construct.yaml files for each operating system because there are OS-specific options. The installer includes conda, R and a base set of R packages. It also includes a sample Jupyter Notebook to work with R. If users want to add additional R or Python packages to the installation, they can use conda.

If you want to build your own installers, try out the tutorial on GitHub.


You May Also Like

News
Continuum Analytics Named a 2017 Gartner Cool Vendor in Data Science and Machine Learning
Data Science and AI platform, Anaconda, empowers leading businesses worldwide with solutions to transform data into intelligence  AUSTIN, Texas—July 13, 2017—Continuum An...
Read More
News
Data Science And Deep Learning Application Leaders Form GPU Open Analytics Initiative
Continuum Analytics, H2O.ai and MapD Technologies Create Open Common Data Frameworks for GPU In-Memory Analytics SAN JOSE, CA—May 8, 2017—Continuum Analytics, H2O.ai, and...
Read More
Enterprise Data Science
Back to School: Data Science & AI Open New Doors for Students
School is back in session and now is the time students are thinking about their future. When considering options, science-oriented students are likely thinking about what is a...
Read More