Code Ocean offers many base environments with different languages pre-installed. You can also use the environment & configuration options to install multiple languages in one compute capsule. Available package managers will suffice for many common languages; less common languages will likely require a setup script.

Which language should I start with?

If you:

  • are not using a pre-installed language, use the "Other" base environment;
  • need proprietary software, such as MATLAB or Stata, start from the proprietary language;
  • use a GPU, start from the language that offers native GPU support (currently C/C++, MATLAB, Python, and Lua) and switch to a base environment with GPU access.

Otherwise, start from the language that most of your code is in.

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 (r-base-dev  will help you install R packages);
  • python for Python (add python-pip  for pip installer support);
  • 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.

 Installing langauges through Conda

If your base image has a conda installer, or if you add it via setup script, you can add languages and language-specific packages via supplemental conda channels.

  • python  is available by default;
  •  julia   is available through conda-forge;
  •  r  is available from channel r .

Installing languages using the Setup Script:

Less common languages will likely require specialized setup scripts to install. For example:

C#:
Mono is an open source implementation of Microsoft's .NET Framework. The Mono project website has instructions for installing Mono on Ubuntu 16.04

Start by choosing the "Other" language, which will get you a minimal Ubuntu environment. You can then write a setup script using the commands from Mono's instructions as is, with one small change: sudo  is not required (nor available by default) on Code Ocean. The resulting Setup Script, with sudo  taken out, looks like this:

#!/bin/bash
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | tee /etc/apt/sources.list.d/mono-official.list
apt-get update -qq && apt-get install -y mono-devel

As a side note, in order to build your project and run it, use the following commands in your run.sh shell script:

xbuild /p:Configuration=Release myproject.csproj
mono bin/Release/myproject.exe

GHDL
Run the following setup script:

#!/bin/bash
buildDeps="ca-certificates gcc gnat make zlib1g-dev"
apt-get update && apt-get install -y $buildDeps
release="20181129" # or whichever release is appropriate
curl -L https://github.com/ghdl/ghdl/archive/$release.tar.gz | tar xz
cd ghdl-$release
./configure --prefix=/usr/local
make && make install
apt-get purge -y --autoremove $buildDeps && rm -rf /var/lib/apt/lists/*

Modelica
Run the following setup script:


#!/bin/bash
apt-get update && apt-get install -y lsb-release
for deb in deb deb-src; do echo "$deb http://build.openmodelica.org/apt `lsb_release -cs` nightly"; done | tee /etc/apt/sources.list.d/openmodelica.list
curl -s http://build.openmodelica.org/apt/openmodelica.asc | apt-key add -
apt-key fingerprint
apt update -qq && apt install -y openmodelica
apt-get purge -y --autoremove lsb-release && rm -rf /var/lib/apt/lists/*

What if I need proprietary software that isn't currently supported?

Contact us at support@codeocean.com and we will be happy to look into it.

Did this answer your question?