Change anaconda ipython main directory

By default the directory where Jupyter was started is uses as a notebook directory. There are different situations where the IPython notebook directory change is necessary.

  1. To change the default notebook directory for all IPython kernel sessions:

    1.1. Open a command window and execute:

         jupyter notebook --generate-config
    

    This will generate .jupiter/jupyter_notebook_config.py file under your home directory.

    1.2. Find, un-comment and modify the following line in your jupyter_notebook_config.py to point to the desired directory:

    # c.NotebookApp.notebook_dir = ''
    

    Next time you launch IPython, it will open with the notebook directory you specified. For example, you can make D:\Sandbox to be your notebook directory:

     c.NotebookApp.notebook_dir = 'D://Sandbox'
    
  2. You can specify notebook directory per kernel session.

    In my everyday work I use Anaconda and IPython notebooks from different locations, including USB sticks. This makes changing the default directory impractical. I start IPython notebook from the command line, specifying the notebook directory.

        jupyter notebook --notebook-dir="D:\Sandbox"
    

    For frequently used directories, I create a command file in the directory itself. The command launches IPython with current directory as notebook directory. Here is what it looks like in a Windows command file:

       jupyter notebook --notebook-dir="%CD%"
    

Not sure if this is helpful, but as of 11/2/15, Anaconda 2.4.0 moved to Jupyter, which has a different method for changing the default directory

In the command line type:

jupyter notebook --generate-config

Which will create a file named jupyter_notebook_config.py in your jupyter directory (In Windows Users/USERNAME/.jupyter). To change the default directory on startup, locate the line:

c.NotebookApp.notebook_dir = u''

And put your preferred directory in the quotes.


You can right click the Start menu shortcut and change the starting directory.

It's not as easy to change the directory used by the Launcher. I think in principle you could edit some file somewhere to change what directory it uses.

Tags:

Anaconda