Setting an environment for a project

Add or edit environments from inside an editing session (JupyterLab shown).

On the left tabs, click the Project tab and find the Environments section. You will see the “default” environment listed. You can Prepare all environments (looks like a list with a checkmark) or Add (+) new environments.

Next to each environment there are icons to Run (open a terminal running), Check or Edit (looks like a pencil) the environment.

../../_images/ae51-project-env-01.png

Creating a new environment

  1. To Create a new environment, click the Add button. This will open a panel that allows you to set the name of the environment and choose whether to inherit from an existing environment.

  2. You can also choose which platforms to support and which channels and packages to include.

    In this example, the environment is named “new_env” and has the notebook package included.

    ../../_images/ae51-project-env-02.png

    TIP: Be sure to add the notebook package to any environment that you want to

    use for notebook projects and the bokeh package to any environment that you want to use for Bokeh projects.

  3. Click Save at the bottom of Environment section to save changes.

  4. Once the new environment has been saved, you will see new options appear in your launcher window. You will see a new terminal launcher with the new environemnt.

    If you have the notebook package in the environment you will also see new notebook launchers as shown below.

    ../../_images/ae51-project-env-03.png

Editing an existing environment

  1. Click the “Edit” pencil icon to change the environment name, view supported platforms, add or remove channels, or add or remove packages.

  2. Click Save at the bottom of Environment section to save changes.

  3. Confirm that the package has been added to your anaconda-project.yml.

    TIP: If anaconda-project.yml is already open, close and reopen it to see changes.

In Jupyter Classic or using the CLI

If you prefer to work at the command line interface (CLI), or are working in Jupyter Classic, open a terminal and run the command anaconda-project add-env-spec --name followed by the environment name. You can add and remove packages or channels from an existing environment using anaconda-project add-packages --env-spec followed by the environment name and any packages.

EXAMPLE: To create an environment called new_env with notebook, pandas and bokeh:

anaconda-project add-env-spec --name new_env
anaconda-project add-packages --env_spec new_env notebook pandas bokeh=0.12

TIP: For more CLI commands type anaconda-project --help.