2018-09-21 23:01:53 +00:00
|
|
|
.. _languages:
|
|
|
|
|
|
|
|
=====================================
|
|
|
|
Choose languages for your environment
|
|
|
|
=====================================
|
|
|
|
|
|
|
|
You can define many different languages in your configuration files. This
|
|
|
|
page describes how to use some of the more common ones.
|
|
|
|
|
|
|
|
Python
|
|
|
|
======
|
|
|
|
|
|
|
|
Your environment will have Python (and specified dependencies) installed when
|
|
|
|
you use one of the following configuration files:
|
|
|
|
|
|
|
|
* ``requirements.txt``
|
|
|
|
* ``environment.yml``
|
|
|
|
|
2019-02-21 09:20:56 +00:00
|
|
|
.. note::
|
2018-09-21 23:01:53 +00:00
|
|
|
|
2019-02-21 09:20:56 +00:00
|
|
|
By default, the environment will have |default_python|.
|
2018-09-21 23:01:53 +00:00
|
|
|
|
2019-02-21 09:20:56 +00:00
|
|
|
.. versionchanged:: 0.8
|
2018-09-21 23:01:53 +00:00
|
|
|
|
2019-02-21 09:20:56 +00:00
|
|
|
Upgraded default Python from 3.6 to 3.7.
|
2018-09-21 23:01:53 +00:00
|
|
|
|
|
|
|
|
2019-02-21 09:20:56 +00:00
|
|
|
Specifying a version of Python
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
To specify a specific version of Python, you have two options:
|
2018-09-21 23:01:53 +00:00
|
|
|
|
2019-02-21 09:20:56 +00:00
|
|
|
* Use :ref:`environment.yml <environment.yml>`. Conda environments let you define
|
|
|
|
the Python version in ``environment.yml``.
|
|
|
|
To do so, add ``python=X.X`` to your dependencies section, like so::
|
2018-09-21 23:01:53 +00:00
|
|
|
|
|
|
|
name: python 2.7
|
|
|
|
dependencies:
|
|
|
|
- python=2.7
|
|
|
|
- numpy
|
|
|
|
|
2019-02-21 09:20:56 +00:00
|
|
|
* Use :ref:`runtime.txt <runtime.txt>` with :ref:`requirements.txt <requirements.txt>`.
|
|
|
|
If you are using ``requirements.txt`` instead of ``environment.yml``,
|
|
|
|
you can specify the Python runtime version in a separate file called ``runtime.txt``.
|
|
|
|
This file contains a single line of the following form::
|
|
|
|
|
|
|
|
python-X.X
|
|
|
|
|
|
|
|
For example::
|
|
|
|
|
|
|
|
python-3.6
|
|
|
|
|
|
|
|
|
2018-09-21 23:01:53 +00:00
|
|
|
The R Language
|
|
|
|
==============
|
|
|
|
|
|
|
|
To ensure that R is installed, you must specify a version of R in a ``runtime.txt``
|
|
|
|
file. This takes the following form::
|
|
|
|
|
|
|
|
r-YYYY-MM-DD
|
|
|
|
|
|
|
|
The date corresponds to the state of the MRAN repository at this day. Make sure
|
|
|
|
that you choose a day with the desired version of your packages. For example,
|
|
|
|
to use the MRAN repository on January 1st, 2018, add this line to ``runtime.txt``::
|
|
|
|
|
|
|
|
r-2018-01-01
|
|
|
|
|
|
|
|
Note that to install specific packages with the R environment, you should
|
|
|
|
use the ``install.R`` configuration file.
|
|
|
|
|
|
|
|
Julia
|
|
|
|
=====
|
|
|
|
|
|
|
|
To build an environment with Julia, include a configuration file called
|
|
|
|
``REQUIRE``. Each line of this file should include a package that you wish
|
|
|
|
to have installed with Julia. For example, the following contents of ``REQURE``
|
|
|
|
would install the ``PyPlot`` package with your Julia environment.::
|
|
|
|
|
|
|
|
PyPlot
|
|
|
|
|
|
|
|
Languages not covered here
|
|
|
|
==========================
|
|
|
|
|
|
|
|
If a language is not "officially" supported by a build pack, it can often be
|
|
|
|
installed with a ``postBuild`` script. This will run arbitrary ``bash`` commands,
|
|
|
|
and can be used to download / install a language.
|
|
|
|
|
|
|
|
Using multiple languages at once
|
|
|
|
================================
|
|
|
|
|
|
|
|
It may also be possible to combine multiple languages in a single environment.
|
|
|
|
The details on how to accomplish this with all possible combinations are outside
|
|
|
|
the scope of this guide. However we recommend that you take a look at the
|
|
|
|
`Multi-Language Demo <https://github.com/binder-examples/multi-language-demo>`_
|
|
|
|
repository for some inspiration.
|