Search code examples
ipythonvirtualenvanacondajupyterjupyter-notebook

How to set a default environment for Anaconda / Jupyter?


I have installed Anaconda for my Machine Learning course. I'm using it as IPython (Jupyter) notebook, in which we have lessons. OS is Ubuntu 14.04 LTS. Basically, I always run it from Terminal with:

jupyter notebook

I have created new environment called su_env from root environment (exact copy) with one package added. Now, I'm wondering: how can I set environment su_env as default one? I have dozen of notebooks so it's annoying to set up each time for every notebook the environment, in "web" GUI of Jupyter.

EDIT: I'm interested in a solution where you don't have to set environment before running notebook. My logic is that, somehow, automagically, jupyter sets root environment on its own while starting up. Because of that, I'm wondering is it possible to set some config file or something so jupyter sets su_env instead of root. Also, if you know that's not possible (and why), I would like to know that.


Solution

  • First activate the conda environment from the command line, then launch the notebook server.

    For example:

    $ source activate env_name
    $ jupyter notebook
    

    jupyter notebook list of environments with env_name as the default environment

    Note: This might only work with environments that were created from within Jupyter Notebook, not environments that were created using conda create on the command line.