Update (Feb 2016): These instructions are now outdated.
The recommended way to install Jupyter (new name for IPython Notebook) is now using Anaconda.
The recommended way to install Jupyter (new name for IPython Notebook) is now using Anaconda.
IPython Notebook is a great tool for prototyping algorithms and analysing data interactively, in particular in combination with powerful numerical libraries such as NumPy, SciPy, matplotlib and OpenCV. But one step after the other.
The IPython install page mentions Python distributions such as Anaconda or Enthought Canopy that come with many packages pre-installed, but I prefer to install all bits from scratch, so I know what’s installed.
So let’s get started on how to install IPython Notebook on Windows 7. Obviously we need admin rights for all of this.
- Install Python
A late 2-series Python, such as 2.7.5, provides the best compatibility with most packages, although support for Python 3 is continuously improving. I also stick to the Win32 (x86) version of Python as a few packages are not available in x64 versions, although the major packages do support this. My favourite Python distribution for Windows is ActivePython. Note that its default install path isC:\Python27\
, which should be changed, e.g. toC:\Program Files (x86)\ActivePython 2.7.5\
. - Install IPython
The easiest way is to runeasy_install ipython[all]
as an administrator (start button, typecmd
, shift+right click on “cmd.exe” and select “Run as administrator”). This installs the latest stable version of IPython including the main required and optional dependencies. - Install libraries
Download and run the official installers for the latest stable versions of NumPy (numerical routines), SciPy (scientific computing) and matplotlib (graphing library). Make sure you pick the version that fits your Python distribution (e.g. win32 python2.7). Note that matplotlib requires additional dependencies that can be installed usingeasy_install python-dateutil pyparsing
. - Install OpenCV bindings (optional)
If one works with image processing or computer vision, the Python bindings of OpenCV can be really useful. The python bindings are included in the main OpenCV installer under the path./build/python/
, but as of OpenCV 2.4.8 only Python 2.7 is included as precompiled Python binary (but for both 32 and 64-bit versions). The file “cv2.pyd” needs to be manually copied to the “site-packages” folder of the Python distribution, e.g. atC:\Program Files (x86)\ActivePython 2.7.5\Lib\site-packages\
. - Start IPython Notebook
Runipython notebook
in a command line. If you’re new to IPython Notebook, get started by looking at the example collection and reading the documentation. - Install MathJax locally (optional)
Typesetting LaTeX within a notebook uses MathJax, which can be installed locally by running the following in Python:from IPython.external.mathjax import install_mathjax install_mathjax()
As of March 2014, the latest versions of libraries were: IPython 1.2.1, NumPy 1.8.0, SciPy 0.13.3, matplotlib 1.3.1, OpenCV 2.4.8.
The problem is, you haven’t explained how to use easy_install.
What’s missing from step 2? Easy_install should be included with the Python distribution.
I also couldn’t initially use easy_install. Here are instructions for getting it:
http://adesquared.wordpress.com/2013/07/07/setting-up-python-and-easy_install-on-windows-7/
Though I actually just dragged ez_setup.py into the command prompt and pressed enter and it worked ~shrugs~
easy_install is included in activepython
Thank you very much!
Very-very good guide
Hi, this was really helpful, but I can only run ipython and ipython notebook if I run the commands from an administrator terminal.
How odd. What kind of error do you get if you try to run IPython in a normal command line?
Just to share some experience: for one that does not work…please use ActivePython as mentioned in the article, rather than the normal Python downloaded from Python.org.
IPython notebook on Python 3.4 cannot print or download on Windows. See here http://stackoverflow.com/questions/25178602/500-server-error-using-ipython-notebook-on-windows
I wish I could help, but I don’t have any experience with Python 3.4 or with Python on Windows x64. Sorry.
Tried several versions. The 2.7.8.10 (x86) active python has easy_install built in. After installing the python, you can directly run easy_install under cmd.exe
steps 1-3 worked fine. However trying to run ipython notebook is step 5, I get an error that ipython is not recognized as an internal or external command.
Looks like ipython is not in the PATH. I think ActivePython should add the correct directory to the path (e.g. C:\Program Files (x86)\ActivePython 2.7.5\Scripts\) during installation.
However, maybe your command line doesn’t use the latest value of the PATH, for example if you opened it before installing ActivePython. Try opening a new command line window (as a normal user) and see if ipython is found now.
If not, you may have to log off and on again, and try again. If this still doesn’t work, then the directory I mentioned above is probably missing from the PATH, so you need to add it yourself.
I’ve install ipython through easy_install and I have not found iputhon folder in PATH
I follow Christian’s comment and problem was solved by adding to PATH
C:\Python27\Scripts
Thanks a lot for such a good step by step explanation! Everything started working after the very first try.
Richardt,
I have downloaded Anaconda and run the following script:
C:\Users\cjw_2>ipython notebook
C:\Python27\lib\site-packages\numpy\core\__init__.py:6: Warning: Numpy 64bit experimental build with
Mingw-w64 and OpenBlas.
from . import multiarray
2015-01-31 13:42:14.296 [NotebookApp] Using existing profile dir: u’C:\\Users\\cjw_2\\.ipython\\prof
ile_default’
2015-01-31 13:42:14.312 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest
/MathJax.js
2015-01-31 13:42:14.344 [NotebookApp] Serving notebooks from local directory: C:\Users\cjw_2
2015-01-31 13:42:14.344 [NotebookApp] 0 active kernels
2015-01-31 13:42:14.359 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/
2015-01-31 13:42:14.359 [NotebookApp] Use Control-C to stop this server and shut down all kernels (t
wice to skip confirmation).
Do you have any advice?
Colin W.
That looks pretty normal to me, and it should have opened IPython notebook in your browser. If it didn’t, open http://localhost:8888/ in a tab, and you should be done.
[…] user (like me) you won’t have a good time, but using easy_install makes life way easier! This tutorial might also be helpful for windows users. If you’re on a Mac or some Linux Distro…. The […]
When I enter “ipython notebook”, I was told “UnicodeDecodeError:’utf8′ codec can’t decode byte 0xbb in position invtart byte”.
Please help me. I have been struggling in installing ipython for a whole way only to find I am not that smart.
This sounds like the same problem as this one:
http://stackoverflow.com/questions/22421841/anaconda-ipython-notebook-getting-unicodedecodeerror-ascii-codec-cant-decod
Try this solution but with UnicodeDecodeError as noted in another answer:
http://stackoverflow.com/a/22509632/72470
easy_install ipython[all] does not work for me.
I install python x86 in C:\Program Files (x86)\ActivePython 2.7.8
Please help
Could you please be more specific? What error do you get? Could it be related to one of the other easy_install issues already discussed above?
Hi,
I am getting this below. Do I need to install ipywidgets?:
PS C:\Program Files (x86)\Python27> ipython notebook
[I 16:38:50.576 NotebookApp] Copying C:\Users\rafa\.ipython\nbextensions -> C:\Users\rafa\AppData\Roaming\jupyter\nbexte
nsions
[W 16:41:11.332 NotebookApp] ipywidgets package not installed. Widgets are unavailable.
[I 16:41:11.358 NotebookApp] Serving notebooks from local directory: C:\Program Files (x86)\Python27
[I 16:41:11.359 NotebookApp] 0 active kernels
[I 16:41:11.361 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 16:41:11.361 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
It’s just a warning that you can ignore. IPython Notebook is running fine.
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\CBIT>cd\
C:\>cd Python27
C:\Python27>ipython notebook
[I 15:29:19.388 NotebookApp] Serving notebooks from local directory: C:\Python27
[I 15:29:19.388 NotebookApp] 0 active kernels
[I 15:29:19.388 NotebookApp] The IPython Notebook is running at: http://localhos
t:8888/
[I 15:29:19.388 NotebookApp] Use Control-C to stop this server and shut down all
kernels (twice to skip confirmation).
[W 15:29:19.657 NotebookApp] 404 GET /static/components/bootstrap/fonts/glyphico
ns-halflings-regular.eot? (::1) 10.00ms referer=http://localhost:8888/tree
i am getting this, and blank on the explorer, what’s the problem
Please don’t post comments as replies to unrelated comments.
It looks like a font belonging to Bootstrap wasn’t found (error 404). Look here for a fix: http://stackoverflow.com/questions/30226847/ipython-notebook-bootstrap-glyph-font-missing
If I try running easy_install ipython[all] I get:
Running gnureadline-6.3.3\setup.py -q bdist_egg –dist-dir c:\users\tomq\appdata\local\temp\easy_install-cyoflt\gnureadline-6.3.3\egg-dist-tmp-npzt0y
error: Setup script exited with Error: this module is not meant to work on Windows (try pyreadline instead)
I have activestate python 32 bit. I have tried manually installing pyreadline, but makes no difference.
Any ideas?
Well, “gnureadline” clearly seems to be the wrong package, and “pyreadline” should work, so I don’t know what the problem is.
You could try running “pip install ipython”, which is the currently recommended way to install IPython/Jupyter and all its dependencies, including readline (http://ipython.readthedocs.org/en/stable/install/install.html). Please let me know if that works.
By a process of just manually installing individual packages as it gave me errors about this that and the other not being found, I have finally got a running system.
pip install python does essentially the same thing, fails on gnureadline.
I’m glad it works now. I just don’t understand why it even attempts to install gnureadline on Windows. Are you perhaps using Cygwin or mingw?
No. Just plain windows.
I installed IPython using the directions above on WinXPSP, I already have Python 3.4.4 installed. When I run ipython notebook from a command line I see a new page in my browser but it doesn’t have the IPython control panel, it has 3 Tabs: Files, Running, Clusters, and when I click “New” to start a notebook “Notebooks” is disabled. Also on the Running tab no terminals or notebooks are running. I clicked on “Untitled.ipynb” to see if that would start a notebook, and it does, a new Tab opened in the browser, with what looks like the correct control panel, and a place to type code : In [ ]:, but I see “Kernel Error” in the browser and a bunch of errors in the CLI and then it terminates IPython. I’ll paste the beginning and end of the error listing from the command line. Any help will be much appreciated.
C:\python34>ipython notebook
[I 00:38:56.254 NotebookApp] Serving notebooks from local directory: C:\python34
[I 00:38:56.254 NotebookApp] 0 active kernels
[I 00:38:56.254 NotebookApp] The Jupyter Notebook is running at: http://localhos
t:8888/
[I 00:38:56.254 NotebookApp] Use Control-C to stop this server and shut down all
kernels (twice to skip confirmation).
Assertion failed: Socket operation on non-socket (bundled\zeromq\src\select.cpp:
185)
Assertion failed: Socket operation on non-socket (bundled\zeromq\src\select.cpp:
185)
[E 00:39:18.737 NotebookApp] Unhandled error in API request
….
[E 00:39:18.784 NotebookApp] 500 POST /api/sessions (127.0.0.1) 3468.57ms refere
r=http://localhost:8888/notebooks/Untitled.ipynb
C:\python34>Assertion failed: Socket operation on non-socket (bundled\zeromq\src
\select.cpp:185)
Assertion failed: Socket operation on non-socket (bundled\zeromq\src\signaler.cp
p:181)
The only thing I could find are these two things, but it doesn’t look like they’d solve your problem:
* http://stackoverflow.com/questions/32649320/issues-in-running-ipython-notebook-on-windows-xp
* https://code.google.com/archive/p/spyderlib/issues/2016
Thank you for your quick reply and for looking into this. I turned off the antivirus and firewall, uninstalled ipython, upgraded pip to the lastest version, installed the latest version of ipython[all], still seeing problems. I ran iptest and the lib section failed, I hope you don’ t mind me posting the results here:
Test group: lib
………………………S……..F……….S………………….
======================================================================
FAIL: testIPythonLexer (IPython.lib.tests.test_lexers.TestLexers)
———————————————————————-
Traceback (most recent call last):
File “c:\python34\lib\site-packages\IPython\lib\tests\test_lexers.py”, line 26, in testIPythonLexer
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
nose.proxy.AssertionError: Lists differ: [(Tok[65 chars]), (Token.Name.Variable,
‘$HOME’), (Token.Text, ‘\n’)] != [(Tok[65 chars]), (Token.Text, ‘$’), (Token.Text, ‘HOME’), (Token.Text, ‘\n’)]
First differing element 3:
(Token.Name.Variable, ‘$HOME’)
(Token.Text, ‘$’)
Second list contains 1 additional elements.
First extra element 5:
(Token.Text, ‘\n’)
[(Token.Operator, ‘!’),
(Token.Name.Builtin, ‘echo’),
(Token.Text, ‘ ‘),
– (Token.Name.Variable, ‘$HOME’),
+ (Token.Text, ‘$’),
+ (Token.Text, ‘HOME’),
(Token.Text, ‘\n’)]
“””Fail immediately, with the given message.”””
>> raise self.failureException(“Lists differ: [(Tok[65 chars]), (Token.Name.Variable, ‘$HOME’), (Token.Text, ‘\\n’)] != [(Tok[65 chars]), (Token.Text, ‘$’), (Token.Text, ‘HOME’), (Token.Text, ‘\\n’)]\n\nFirst differing element 3:\n(Token.Name.Variable, ‘$HOME’)\n(Token.Text, ‘$’)\n\nSecond list contains 1 additional elements.\nFirst extra element 5:\n(Token.Text, ‘\\n’)\n\n [(Token.Operator, ‘!’),\n (Token.Name.Builtin, ‘echo’),\n (Token.Text, ‘ ‘),\n- (Token.Name.Variable, ‘$HOME’),\n+ (Token.Text, ‘$’),\n+ (Token.Text, ‘HOME’),\n (Token.Text, ‘\\n’)]”)
———————————————————————-
Ran 70 tests in 6.234s
FAILED (SKIP=2, failures=1)
I have no idea about this and again couldn’t find any solution about this.
If I had to guess, I would blame the unusual combination of Windows XP and the latest Jupyther/Python 3.4. Although Windows XP is officially supported by Python 3.4, the Jupyter developer perhaps may not have test Windows XP anymore.
One thing you could try is to install Anaconda (https://www.continuum.io/downloads#_windows), which bundles everything you should need.
Hi Christian,
Thank you very much for writing such a great post! I’m in China now and wasn’t able to download Anaconda from its website. Your post helped me take a detour and solve my problem. Thank you!
Christian,
You deserve a round of applause for following up on so many problems with such great research. This page catapulted me forward in my quest to install IPython on Windows. Thanks for your time and effort here!
Ben