Skip to content

R and Python programs

Before you start

Goal

  • Run R and Python on a worker node.

Prerequisites

  • A configured Hub server.
  • A configured worker node.
  • Administration privileges for the server host and worker node.

Configuration for R and Python programs

In order to execute R and Python programs on the worker node, some environment variables must be configured in the hub configuration file [etc directory]/nomad_plugin.yaml.

Create a copy of the file [etc directory]/nomad_plugin_default.yaml if it does not exist and check the ownership and permissions are correct.

Append the following section to that file, substituting the correct paths if different from those shown in this example:

env:
  PYTHONHOME: /opt/anaconda
  PYTHONLIB: /opt/anaconda/lib/libpython3.8.so.1.0
  R_HOME: /usr/lib64/R

R Programs

In order to interact with R from the hub at the minimum the jsonlite package needs to be installed. To run all the examples, the randomForest and chron packages also need to be installed.

This is performed in the standard way, through R outside the hub e.g.

install.packages('jsonlite', dependencies=TRUE, repos='http://cran.rstudio.com/')
Other packages should be installed as desired

Python Programs

In order to interact with Python from the hub at the minimum the numpy, pandas and matplotlib packages need to be installed.

This is performed in the standard way, outside the hub e.g.

pip3 install --no-cache-dir numpy pandas matplotlib
Other packages should be installed as desired