Running iPython Notebook From Vagrant/VirtualBox

Updated 9/1/2014 to add a few more IPython Notebook dependencies.

Honestly, you’d think it would be easy to remember these four simple steps, but I never seem to. Since IPython notebook is pretty much the greatest thing since sliced bread, here’s how to run it in Vagrant/VirtualBox and access the notebook from the host machine’s browser.

  1. Make sure the prerequisite packages are installed in the virtual machine’s Python environment:*
    • jinja2
    • sphinx
    • pyzmq
    • pygments
    • tornado
    • ipython
  2. Make sure your Vagrant file is forwarding port 8888 to port 8888 (or whatever you’d like to use):
  3. In your virtual machine, run the IPython notebook server: ipython notebook ––ip=0.0.0.0
  4. View the notebook in the host’s browser: http://localhost:8888

*Alternately, you can pip install ipython[notebook] to install IPython and all Notebook dependencies. I got errors when doing this via zsh, though it worked after switching to Bash.

Update 11/6/2014: Praful Mathur left a good tip for using the pip install ipython[notebook] syntax with zsh. You have to escape the hard brackets: pip install ipython\[all\]. Thanks!

,

12 Responses to Running iPython Notebook From Vagrant/VirtualBox

  1. José Ricardo November 5, 2013 at 7:20 am #

    Hi, this helped me. Thank you.

  2. Anh June 22, 2014 at 8:56 am #

    Thanks. –ip 0.0.0.0

  3. Praful mathur November 6, 2014 at 10:26 am #

    It works in ZSH but you have to escape the hard brackets to ‘pip install ipython\[all\]’

  4. Becky November 6, 2014 at 7:25 pm #

    The ZSH thing was driving me nuts. Thanks so much for the clarification–post updated!

  5. Mike G. May 8, 2015 at 9:48 am #

    I was struggling with the same problem. It is working now, thanks!

  6. David Laxer July 8, 2015 at 2:57 pm #

    ipython notebook –ip=0.0.0.0 is running in my guest Ubuntu / Vagrant virtual box.
    I forwarded the port: 8888->8001, but I still can’t access the notebook server from my host
    OS X 10.10.3.

    Vagrantfile:

    config.vm.network :forwarded_port, host: 8001, guest: 8888, auto_correct: true # IPython port (set in notebook config)

    Curiously, it work from a different virtual box (e.g. Spark).

    David-Laxers-MacBook-Pro:coreos-vagrant davidlaxer$ vagrant suspend
    ==> core-01: Saving VM state and suspending execution…
    David-Laxers-MacBook-Pro:coreos-vagrant davidlaxer$ vi Vagrantfile
    David-Laxers-MacBook-Pro:coreos-vagrant davidlaxer$ vagrant up
    Bringing machine ‘core-01′ up with ‘virtualbox’ provider…
    ==> core-01: Checking if box ‘coreos-alpha’ is up to date…
    ==> core-01: Resuming suspended VM…
    ==> core-01: Booting VM…
    ==> core-01: Waiting for machine to boot. This may take a few minutes…
    core-01: SSH address: 127.0.0.1:2222
    core-01: SSH username: core
    core-01: SSH auth method: private key
    ==> core-01: Machine booted and ready!
    David-Laxers-MacBook-Pro:coreos-vagrant davidlaxer$ vagrant ssh
    Last login: Mon Jul 6 19:15:36 2015 from 10.0.2.2
    CoreOS alpha (723.1.0)
    Failed Units: 1
    format-ephemeral.service
    core@core-01 ~ $ docker run -ti –net=host –rm -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/.Xauthority:/root/.Xauthority -e DISPLAY=$DISPLAY -e XAUTHORITY=/root/.Xauthority –privileged nashamri/nupic
    root@core-01:/home/docker# ipython notebook –ip=0.0.0.0
    2015-07-06 19:25:02.756 [NotebookApp] Created profile dir: u’/root/.ipython/profile_default’
    2015-07-06 19:25:02.763 [NotebookApp] Using system MathJax
    2015-07-06 19:25:02.785 [NotebookApp] Serving notebooks from local directory: /home/docker
    2015-07-06 19:25:02.785 [NotebookApp] The IPython Notebook is running at: http://0.0.0.0:8888/
    2015-07-06 19:25:02.785 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
    2015-07-06 19:25:02.785 [NotebookApp] WARNING | No web browser found: could not locate runnable browser.

  7. Ed December 15, 2015 at 4:21 am #

    I spent the whole day trying to get jupyter working, and all this time it was just what you recommended in starting it with –ip=0.0.0.0. Is there a way to specify in the configuration file?

    Thanks for getting my jupyter working!!!!

  8. Guy Fawkes February 9, 2016 at 5:16 pm #

    –ip=0.0.0.0 worked like a charm, but why?

  9. http://www.blrimages.net/ April 28, 2016 at 6:14 pm #

    Olá Mel,Pelo jeito você não procurou um pouquinho no blog o artigo que eu falo sobre isso…Veja esse artigo e você terá a resposta

  10. http://www.blrimages.net/ April 28, 2016 at 6:20 pm #

    Youre so fantastic, guy! I cant think I missed this blogging site for so very long. Its just awesome things all spherical. Your style and design, guy…far too wonderful! I cant wait around to browse what youve obtained future. I love all sorts of things that youre stating and want far more, far more, Extra! Continue to keep this up, male! Its just far too decent.

  11. http://www.sorethumbsblog.com/ April 28, 2016 at 6:20 pm #

    Aw your outside reading spot looks lovely! I prefer a relaxed approach to the readathon, although I did spent too much time on Twitter following the readathon hashtag.

  12. ingrid November 16, 2016 at 12:09 am #

    hey there — i get this error `No web browser found: could not locate runnable browser.` wdyt is possible to fix here?

Leave a Reply