How-to | Create a code environment#

Code environments address the problem of managing dependencies and versions when writing code in Python and R. They are similar to the Python virtualenv or to renv for R users.


Instance administrators can set permissions to create, modify, and use code environments. Consult the reference documentation for details.

Options to create a code environment#

There are two main ways to create a code environment:

  • Create a new Python or R environment from scratch and import various packages to it.

  • Import a previously created Python or R environment from a zip file into a Dataiku instance and optionally configure it further.

Find the Code Envs page#

Navigating to where you can create a code environment differs depending on whether you are using Dataiku Cloud or a self-managed instance.

  1. From the Dataiku Cloud Launchpad, select the Code Envs panel.

  2. Click Add a Code Env.

  1. From the Dataiku Design homepage, click the Applications > Administration menu in the top navigation bar.

  2. Navigate to the Code Envs tab.

Create a code environment from scratch#

Once in the Code Envs tab, the process to create a code environment is the same. We’ll demonstrate Python, but the process for R is similar.

  1. Click New Python Env.

  2. Give it a descriptive name.

  3. Select a Python version.

  4. Leave the default deployment type, Managed by DSS (recommended), and other default settings for conda, mandatory packages, and Jupyter.

  5. Click Create.

Dataiku screenshot of the dialog for creating a new code environment.


As explained in the reference documentation, you’ll need the requested version of Python to be installed on your system in order to create that kind of code environment.

Install packages in a code environment#

The next step is to install the packages that you want to include in the environment.

  1. Once the environment has been created, select Currently installed packages. Notice that the mandatory packages are already installed.

  2. Select Packages to install. This is where you can install additional packages.

  3. Under Requested packages, you have the option to Add Sets of Packages frequently used together for common tasks according to certain infrastructure requirements.

  4. You can also directly enter specific packages you would like to include in the Requested packages (Pip) code field. Use the Syntax help to ensure the correct format.

  5. Click Save and Update.

Dataiku screenshot of the packages to install page of a code env.


To apply a custom code environment in Dataiku objects like projects, recipes, and notebooks, see How-to | Set a code environment.


As an example, let’s create a single code environment with all the required packages for the tutorials of the Developer learning path.

  1. Navigate to the Code Envs page.

  2. Create a new Python 3.6 code environment named py36-developer-v9.

  3. Under Packages to install, click Add Sets of Packages > Visual Machine Learning and Visual Time series forecasting (CPU).

  4. Also in the Requested packages field, paste the packages below:

  5. Click Save and Update.