Setting Up New or Additional Languages

Environment editor provides flexibility to set up your computation environment. After you select a starter environment, you can add additional languages to your capsule.

If you are building a bi or multi-language capsule:

  • Use a base Ubuntu (18.04 or 16.04) environment, if you are not using a pre-installed language.

  • Start from an environment with the proprietary language if you are using one, for example Matlab.

  • Select an environment with GPU access, these will be labeled as such, or will reference CUDA or a deep learning framework, if you are using GPU.

Installing a Language Using Package Managers

The following are all available as apt-get packages:

  • build-essential for the C/C++ toolchain (gcc/g++, make, etc.);

  • r-base for R (note: r-base-dev will help you install R packages, we recommend adding a MRAN snapshot for installing archived R packages, see more detail below);

  • octave for Octave;

  • python-pip for Python 2 and the pip installer;

  • python3-pip for Python 3 and the pip3 installer;

  • perl for Perl (add cpanm if needed);

  • luajit for Lua (add luarocks if needed);

  • default-jdk for Java;

  • gfortran for Fortran.

Once you add R or python, the commands Rscript or python will become available, respectively.

Adding R Language

Installing R in a non-R environment, or updating to the most recent version

While Code Ocean's environments are based on a recent version of Ubuntu (18.04 code name "Bionic Beaver" or just "Bionic"), the version of R it included is 3.4.4. To get newer versions of R to install on Code Ocean:

  1. In the environment editor, click the gear icon next to apt-get. This will open the apt-get configuration window.

  2. In Additional sources, copy and paste deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ (for R 3.6) or deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ (for R 4.0). This tells apt-get to search for packages on the R project's own repository.

  3. In GPG Keys, copy and paste E298A3A825C0D65DFD57CBB651716619E084DAB9. This is a piece of information provided by the R project to guarantee the authenticity of the repository.

4. Click Save.

5. Navigate back to the environment editor.

6. Add r-base as an apt-get dependency, this step is crucial.

Note: the various R installer options will show up automatically, which you can immediately add packages to.