##// END OF EJS Templates
update 1.1 to 2.0
Matthias BUSSONNIER -
Show More
@@ -1,268 +1,269 b''
1 """Utility function for installing MathJax javascript library into
1 """Utility function for installing MathJax javascript library into
2 the notebook's 'static' directory, for offline use.
2 the notebook's 'static' directory, for offline use.
3
3
4 Authors:
4 Authors:
5
5
6 * Min RK
6 * Min RK
7 * Mark Sienkiewicz
7 * Mark Sienkiewicz
8 * Matthias Bussonnier
8 * Matthias Bussonnier
9
9
10 To download and install MathJax:
10 To download and install MathJax:
11
11
12 From Python:
12 From Python:
13
13
14 >>> from IPython.external.mathjax import install_mathjax
14 >>> from IPython.external.mathjax import install_mathjax
15 >>> install_mathjax()
15 >>> install_mathjax()
16
16
17 From the command line:
17 From the command line:
18
18
19 $ python -m IPython.external.mathjax
19 $ python -m IPython.external.mathjax
20
20
21 To install MathJax from a file you have already downloaded:
21 To install MathJax from a file you have already downloaded:
22
22
23 $ python -m IPython.external.mathjax mathjax-xxx.tar.gz
23 $ python -m IPython.external.mathjax mathjax-xxx.tar.gz
24 $ python -m IPython.external.mathjax mathjax-xxx.zip
24 $ python -m IPython.external.mathjax mathjax-xxx.zip
25
25
26 It will not install MathJax if it is already there. Use -r to
26 It will not install MathJax if it is already there. Use -r to
27 replace the existing copy of MathJax.
27 replace the existing copy of MathJax.
28
28
29 To find the directory where IPython would like MathJax installed:
29 To find the directory where IPython would like MathJax installed:
30
30
31 $ python -m IPython.external.mathjax -d
31 $ python -m IPython.external.mathjax -d
32
32
33 """
33 """
34
34
35 #-----------------------------------------------------------------------------
35 #-----------------------------------------------------------------------------
36 # Copyright (C) 2008-2011 The IPython Development Team
36 # Copyright (C) 2008-2011 The IPython Development Team
37 #
37 #
38 # Distributed under the terms of the BSD License. The full license is in
38 # Distributed under the terms of the BSD License. The full license is in
39 # the file COPYING, distributed as part of this software.
39 # the file COPYING, distributed as part of this software.
40 #-----------------------------------------------------------------------------
40 #-----------------------------------------------------------------------------
41
41
42
42
43 #-----------------------------------------------------------------------------
43 #-----------------------------------------------------------------------------
44 # Imports
44 # Imports
45 #-----------------------------------------------------------------------------
45 #-----------------------------------------------------------------------------
46
46
47 import os
47 import os
48 import shutil
48 import shutil
49 import sys
49 import sys
50 import tarfile
50 import tarfile
51 import urllib2
51 import urllib2
52 import zipfile
52 import zipfile
53
53
54 from IPython.utils.path import locate_profile
54 #-----------------------------------------------------------------------------
55 #-----------------------------------------------------------------------------
55 #
56 #
56 #-----------------------------------------------------------------------------
57 #-----------------------------------------------------------------------------
57
58
58 # Where mathjax will be installed.
59 # Where mathjax will be installed.
59
60
60 dest = os.path.join(locate_profile('default'), 'static')
61 dest = os.path.join(locate_profile('default'), 'static')
61
62
62 ##
63 ##
63
64
64 # Test for access to install mathjax.
65 # Test for access to install mathjax.
65
66
66 def check_perms(replace=False):
67 def check_perms(replace=False):
67 if not os.access(static, os.W_OK):
68 if not os.access(static, os.W_OK):
68 raise IOError("Need have write access to %s" % static)
69 raise IOError("Need have write access to %s" % static)
69 if os.path.exists(dest):
70 if os.path.exists(dest):
70 if replace:
71 if replace:
71 if not os.access(dest, os.W_OK):
72 if not os.access(dest, os.W_OK):
72 raise IOError("Need have write access to %s" % dest)
73 raise IOError("Need have write access to %s" % dest)
73 print "removing previous MathJax install"
74 print "removing previous MathJax install"
74 shutil.rmtree(dest)
75 shutil.rmtree(dest)
75 return True
76 return True
76 else:
77 else:
77 print "offline MathJax apparently already installed"
78 print "offline MathJax apparently already installed"
78 return False
79 return False
79 else :
80 else :
80 return True
81 return True
81
82
82 ##
83 ##
83
84
84 def extract_tar( fd, dest ) :
85 def extract_tar( fd, dest ) :
85 # use 'r|gz' stream mode, because socket file-like objects can't seek:
86 # use 'r|gz' stream mode, because socket file-like objects can't seek:
86 tar = tarfile.open(fileobj=fd, mode='r|gz')
87 tar = tarfile.open(fileobj=fd, mode='r|gz')
87
88
88 # we just happen to know that the first entry in the mathjax
89 # we just happen to know that the first entry in the mathjax
89 # archive is the directory that the remaining members are in.
90 # archive is the directory that the remaining members are in.
90 topdir = tar.firstmember.path
91 topdir = tar.firstmember.path
91
92
92 # extract the archive (contains a single directory) to the static/ directory
93 # extract the archive (contains a single directory) to the static/ directory
93 tar.extractall(static)
94 tar.extractall(static)
94
95
95 # it will be mathjax-MathJax-<sha>, rename to just mathjax
96 # it will be mathjax-MathJax-<sha>, rename to just mathjax
96 os.rename(os.path.join(static, topdir), dest)
97 os.rename(os.path.join(static, topdir), dest)
97
98
98 ##
99 ##
99
100
100 def extract_zip( fd, dest ) :
101 def extract_zip( fd, dest ) :
101 z = zipfile.ZipFile( fd, 'r' )
102 z = zipfile.ZipFile( fd, 'r' )
102
103
103 # we just happen to know that the first entry in the mathjax
104 # we just happen to know that the first entry in the mathjax
104 # archive is the directory that the remaining members are in.
105 # archive is the directory that the remaining members are in.
105 topdir = z.namelist()[0]
106 topdir = z.namelist()[0]
106
107
107 # extract the archive (contains a single directory) to the static/ directory
108 # extract the archive (contains a single directory) to the static/ directory
108 z.extractall( static )
109 z.extractall( static )
109
110
110 # it will be mathjax-MathJax-<sha>, rename to just mathjax
111 # it will be mathjax-MathJax-<sha>, rename to just mathjax
111 d = os.path.join(static, topdir)
112 d = os.path.join(static, topdir)
112 print d
113 print d
113 os.rename(os.path.join(static, topdir), dest)
114 os.rename(os.path.join(static, topdir), dest)
114
115
115 ##
116 ##
116
117
117 def install_mathjax(tag='v2.0', replace=False, file=None, extractor=extract_tar ):
118 def install_mathjax(tag='v2.0', replace=False, file=None, extractor=extract_tar ):
118 """Download and/or install MathJax for offline use.
119 """Download and/or install MathJax for offline use.
119
120
120 This will install mathjax to the 'static' dir in the IPython notebook
121 This will install mathjax to the 'static' dir in the IPython notebook
121 package, so it will fail if the caller does not have write access
122 package, so it will fail if the caller does not have write access
122 to that location.
123 to that location.
123
124
124 MathJax is a ~15MB download, and ~150MB installed.
125 MathJax is a ~15MB download, and ~150MB installed.
125
126
126 Parameters
127 Parameters
127 ----------
128 ----------
128
129
129 replace : bool [False]
130 replace : bool [False]
130 Whether to remove and replace an existing install.
131 Whether to remove and replace an existing install.
131 tag : str ['v2.0']
132 tag : str ['v2.0']
132 Which tag to download. Default is 'v1.1', the current stable release,
133 Which tag to download. Default is 'v2.0', the current stable release,
133 but alternatives include 'v1.1a' and 'master'.
134 but alternatives include 'v1.1a' and 'master'.
134 file : file like object [ defualt to content of https://github.com/mathjax/MathJax/tarball/#{tag}]
135 file : file like object [ defualt to content of https://github.com/mathjax/MathJax/tarball/#{tag}]
135 File handle from which to untar/unzip/... mathjax
136 File handle from which to untar/unzip/... mathjax
136 extractor : function
137 extractor : function
137 Method tu use to untar/unzip/... `file`
138 Method tu use to untar/unzip/... `file`
138 """
139 """
139
140
140 if not check_perms(replace) :
141 if not check_perms(replace) :
141 return
142 return
142
143
143 if file is None :
144 if file is None :
144 # download mathjax
145 # download mathjax
145 mathjax_url = "https://github.com/mathjax/MathJax/tarball/%s"%tag
146 mathjax_url = "https://github.com/mathjax/MathJax/tarball/%s"%tag
146 print "Downloading mathjax source from %s"%mathjax_url
147 print "Downloading mathjax source from %s"%mathjax_url
147 response = urllib2.urlopen(mathjax_url)
148 response = urllib2.urlopen(mathjax_url)
148 file = response.fp
149 file = response.fp
149
150
150 print "Extracting to %s"%dest
151 print "Extracting to %s"%dest
151 extractor( fd, dest )
152 extractor( fd, dest )
152
153
153 ##
154 ##
154
155
155 def test_func( remove ) :
156 def test_func( remove ) :
156 """See if mathjax appears to be installed correctly"""
157 """See if mathjax appears to be installed correctly"""
157 if not os.path.isdir( dest ) :
158 if not os.path.isdir( dest ) :
158 print "%s directory not found"%dest
159 print "%s directory not found"%dest
159 status=1
160 status=1
160 if not os.path.exists( dest + "/MathJax.js" ) :
161 if not os.path.exists( dest + "/MathJax.js" ) :
161 print "MathJax.js not present in %s"%dest
162 print "MathJax.js not present in %s"%dest
162 status=1
163 status=1
163 print "ok"
164 print "ok"
164 if remove :
165 if remove :
165 shutil.rmtree( dest )
166 shutil.rmtree( dest )
166 return status
167 return status
167
168
168 ##
169 ##
169
170
170 def main( args ) :
171 def main( args ) :
171 # This main is just simple enough that it is not worth the
172 # This main is just simple enough that it is not worth the
172 # complexity of argparse
173 # complexity of argparse
173
174
174 # What directory is mathjax in?
175 # What directory is mathjax in?
175 if '-d' in args :
176 if '-d' in args :
176 print dest
177 print dest
177 return
178 return
178
179
179 # help
180 # help
180 if '-h' in args or '--help' in args :
181 if '-h' in args or '--help' in args :
181 print __doc__
182 print __doc__
182 return
183 return
183
184
184 # remove/replace existing mathjax?
185 # remove/replace existing mathjax?
185 if '-r' in args :
186 if '-r' in args :
186 replace = True
187 replace = True
187 args.remove('-r')
188 args.remove('-r')
188 else :
189 else :
189 replace = False
190 replace = False
190
191
191 # undocumented test interface
192 # undocumented test interface
192 if '-test' in args :
193 if '-test' in args :
193 return test_func( replace )
194 return test_func( replace )
194
195
195 # do it
196 # do it
196 if len(args) == 0 :
197 if len(args) == 0 :
197 # This is compatible with the interface documented in ipython 0.13
198 # This is compatible with the interface documented in ipython 0.13
198 install_mathjax( replace=replace )
199 install_mathjax( replace=replace )
199 else :
200 else :
200 fname = args[0]
201 fname = args[0]
201
202
202 # automatically detect zip/tar - could do something based
203 # automatically detect zip/tar - could do something based
203 # on file content, but really not cost-effective here.
204 # on file content, but really not cost-effective here.
204 if fname.endswith('.zip') :
205 if fname.endswith('.zip') :
205 extractor = extract_zip
206 extractor = extract_zip
206 else :
207 else :
207 extractor = extract_tar
208 extractor = extract_tar
208
209
209 # do it
210 # do it
210 install_mathjax(fd=open(args[0],"r"), replace=replace, extractor=extractor )
211 install_mathjax(fd=open(args[0],"r"), replace=replace, extractor=extractor )
211
212
212 if __name__ == '__main__' :
213 if __name__ == '__main__' :
213 sys.exit(main( sys.argv[1:] ))
214 sys.exit(main( sys.argv[1:] ))
214
215
215 __all__ = ['install_mathjax','main','dest']
216 __all__ = ['install_mathjax','main','dest']
216
217
217 """
218 """
218 Test notes:
219 Test notes:
219
220
220 IPython uses IPython.testing.iptest as a custom test controller
221 IPython uses IPython.testing.iptest as a custom test controller
221 (though it is based on nose). It might be possible to fit automatic
222 (though it is based on nose). It might be possible to fit automatic
222 tests of installation into that framework, but it looks awkward to me.
223 tests of installation into that framework, but it looks awkward to me.
223 So, here is a manual procedure for testing this automatic installer.
224 So, here is a manual procedure for testing this automatic installer.
224
225
225 Mark Sienkiewicz, 2012-08-06
226 Mark Sienkiewicz, 2012-08-06
226 first 8 letters of my last name @ stsci.edu
227 first 8 letters of my last name @ stsci.edu
227
228
228 # remove mathjax from the installed ipython instance
229 # remove mathjax from the installed ipython instance
229 # IOError ok if mathjax was never installed yet.
230 # IOError ok if mathjax was never installed yet.
230
231
231 python -m IPython.external.mathjax -test -r
232 python -m IPython.external.mathjax -test -r
232
233
233 # download and install mathjax from command line:
234 # download and install mathjax from command line:
234
235
235 python -m IPython.external.mathjax
236 python -m IPython.external.mathjax
236 python -m IPython.external.mathjax -test -r
237 python -m IPython.external.mathjax -test -r
237
238
238 # download and install from within python
239 # download and install from within python
239
240
240 python -c "from IPython.external.mathjax import install_mathjax; install_mathjax()"
241 python -c "from IPython.external.mathjax import install_mathjax; install_mathjax()"
241 python -m IPython.external.mathjax -test -r
242 python -m IPython.external.mathjax -test -r
242
243
243 # view http://www.mathjax.org/download/ in your browser
244 # view http://www.mathjax.org/download/ in your browser
244 # save-as the link for MathJax-1.1 near the bottom of the page.
245 # save-as the link for MathJax-2.0 near the bottom of the page.
245 # The file it offers is mathjax-MathJax-v1.1-0-g5a7e4d7.zip
246 # The file it offers is mathjax-MathJax-v2.0-20-g07669ac.zip
246
247
247 python -m IPython.external.mathjax mathjax-MathJax-v1.1-0-g5a7e4d7.zip
248 python -m IPython.external.mathjax mathjax-MathJax-v2.0-20-g07669ac.zip
248 python -m IPython.external.mathjax -test -r
249 python -m IPython.external.mathjax -test -r
249
250
250 # download https://github.com/mathjax/MathJax/tarball/v1.1 in your browser
251 # download https://github.com/mathjax/MathJax/tarball/v2.0 in your browser
251 # (this is the url used internally by install_mathjax)
252 # (this is the url used internally by install_mathjax)
252 # The file it offers is mathjax-MathJax-v1.1-0-g5a7e4d7.tar.gz
253 # The file it offers is mathjax-MathJax-v2.0-20-g07669ac.tar.gz
253
254
254 python -m IPython.external.mathjax mathjax-MathJax-v1.1-0-g5a7e4d7.tar.gz
255 python -m IPython.external.mathjax mathjax-MathJax-v2.0-20-g07669ac.tar.gz
255
256
256 python -m IPython.external.mathjax -test
257 python -m IPython.external.mathjax -test
257 # note no -r
258 # note no -r
258
259
259 # install it again while it is already there
260 # install it again while it is already there
260
261
261 python -m IPython.external.mathjax mathjax-MathJax-v1.1-0-g5a7e4d7.tar.gz
262 python -m IPython.external.mathjax mathjax-MathJax-v2.0-20-g07669ac.tar.gz
262 # says "offline MathJax apparently already installed"
263 # says "offline MathJax apparently already installed"
263
264
264 python -m IPython.external.mathjax ~/mathjax-MathJax-v1.1-0-g5a7e4d7.tar.gz
265 python -m IPython.external.mathjax ~/mathjax-MathJax-v2.0-20-g07669ac.tar.gz
265 python -m IPython.external.mathjax -test
266 python -m IPython.external.mathjax -test
266
267
267
268
268 """
269 """
@@ -1,388 +1,388 b''
1 Overview
1 Overview
2 ========
2 ========
3
3
4 This document describes the steps required to install IPython. IPython is
4 This document describes the steps required to install IPython. IPython is
5 organized into a number of subpackages, each of which has its own dependencies.
5 organized into a number of subpackages, each of which has its own dependencies.
6 All of the subpackages come with IPython, so you don't need to download and
6 All of the subpackages come with IPython, so you don't need to download and
7 install them separately. However, to use a given subpackage, you will need to
7 install them separately. However, to use a given subpackage, you will need to
8 install all of its dependencies.
8 install all of its dependencies.
9
9
10 Please let us know if you have problems installing IPython or any of its
10 Please let us know if you have problems installing IPython or any of its
11 dependencies. Officially, IPython requires Python 2.6, 2.7, 3.1, or 3.2.
11 dependencies. Officially, IPython requires Python 2.6, 2.7, 3.1, or 3.2.
12
12
13 .. warning::
13 .. warning::
14
14
15 Since version 0.11, IPython has a hard syntax dependency on 2.6, and will no
15 Since version 0.11, IPython has a hard syntax dependency on 2.6, and will no
16 longer work on Python <= 2.5. You can find older versions of IPython which
16 longer work on Python <= 2.5. You can find older versions of IPython which
17 supported Python <= 2.5 `here <http://archive.ipython.org/release/>`_
17 supported Python <= 2.5 `here <http://archive.ipython.org/release/>`_
18
18
19 Some of the installation approaches use the :mod:`distribute` package and its
19 Some of the installation approaches use the :mod:`distribute` package and its
20 :command:`easy_install` command line program. In many scenarios, this provides
20 :command:`easy_install` command line program. In many scenarios, this provides
21 the most simple method of installing IPython and its dependencies. More
21 the most simple method of installing IPython and its dependencies. More
22 information about :mod:`distribute` can be found on `its PyPI page
22 information about :mod:`distribute` can be found on `its PyPI page
23 <http://pypi.python.org/pypi/distribute>`__.
23 <http://pypi.python.org/pypi/distribute>`__.
24
24
25 .. note::
25 .. note::
26
26
27 On Windows, IPython has a hard dependency on :mod:`distribute`. We hope to
27 On Windows, IPython has a hard dependency on :mod:`distribute`. We hope to
28 change this in the future, but for now on Windows, you *must* install
28 change this in the future, but for now on Windows, you *must* install
29 :mod:`distribute`.
29 :mod:`distribute`.
30
30
31 More general information about installing Python packages can be found in
31 More general information about installing Python packages can be found in
32 `Python's documentation <http://docs.python.org>`_.
32 `Python's documentation <http://docs.python.org>`_.
33
33
34
34
35 Quickstart
35 Quickstart
36 ==========
36 ==========
37
37
38 If you have :mod:`distribute` installed and you are on OS X or Linux (not
38 If you have :mod:`distribute` installed and you are on OS X or Linux (not
39 Windows), the following will download and install IPython *and* the main
39 Windows), the following will download and install IPython *and* the main
40 optional dependencies:
40 optional dependencies:
41
41
42 .. code-block:: bash
42 .. code-block:: bash
43
43
44 $ easy_install ipython[zmq,qtconsole,notebook,test]
44 $ easy_install ipython[zmq,qtconsole,notebook,test]
45
45
46 This will get:
46 This will get:
47
47
48 - pyzmq, needed for IPython's parallel computing features, qt console and
48 - pyzmq, needed for IPython's parallel computing features, qt console and
49 notebook.
49 notebook.
50 - pygments, used by the Qt console for syntax highlighting.
50 - pygments, used by the Qt console for syntax highlighting.
51 - tornado, needed by the web-based notebook
51 - tornado, needed by the web-based notebook
52 - nose, used by the test suite.
52 - nose, used by the test suite.
53
53
54 To run IPython's test suite, use the :command:`iptest` command:
54 To run IPython's test suite, use the :command:`iptest` command:
55
55
56 .. code-block:: bash
56 .. code-block:: bash
57
57
58 $ iptest
58 $ iptest
59
59
60
60
61 Installing IPython itself
61 Installing IPython itself
62 =========================
62 =========================
63
63
64 Given a properly built Python, the basic interactive IPython shell will work
64 Given a properly built Python, the basic interactive IPython shell will work
65 with no external dependencies. However, some Python distributions
65 with no external dependencies. However, some Python distributions
66 (particularly on Windows and OS X), don't come with a working :mod:`readline`
66 (particularly on Windows and OS X), don't come with a working :mod:`readline`
67 module. The IPython shell will work without :mod:`readline`, but will lack
67 module. The IPython shell will work without :mod:`readline`, but will lack
68 many features that users depend on, such as tab completion and command line
68 many features that users depend on, such as tab completion and command line
69 editing. If you install IPython with :mod:`distribute`, (e.g. with
69 editing. If you install IPython with :mod:`distribute`, (e.g. with
70 `easy_install`), then the appropriate :mod:`readline` for your platform will be
70 `easy_install`), then the appropriate :mod:`readline` for your platform will be
71 installed. See below for details of how to make sure you have a working
71 installed. See below for details of how to make sure you have a working
72 :mod:`readline`.
72 :mod:`readline`.
73
73
74 Installation using easy_install
74 Installation using easy_install
75 -------------------------------
75 -------------------------------
76
76
77 If you have :mod:`distribute` installed, the easiest way of getting IPython is
77 If you have :mod:`distribute` installed, the easiest way of getting IPython is
78 to simply use :command:`easy_install`:
78 to simply use :command:`easy_install`:
79
79
80 .. code-block:: bash
80 .. code-block:: bash
81
81
82 $ easy_install ipython
82 $ easy_install ipython
83
83
84 That's it.
84 That's it.
85
85
86 Installation from source
86 Installation from source
87 ------------------------
87 ------------------------
88
88
89 If you don't want to use :command:`easy_install`, or don't have it installed,
89 If you don't want to use :command:`easy_install`, or don't have it installed,
90 just grab the latest stable build of IPython from `here
90 just grab the latest stable build of IPython from `here
91 <http://ipython.org/download.html>`_. Then do the following:
91 <http://ipython.org/download.html>`_. Then do the following:
92
92
93 .. code-block:: bash
93 .. code-block:: bash
94
94
95 $ tar -xzf ipython.tar.gz
95 $ tar -xzf ipython.tar.gz
96 $ cd ipython
96 $ cd ipython
97 $ python setup.py install
97 $ python setup.py install
98
98
99 If you are installing to a location (like ``/usr/local``) that requires higher
99 If you are installing to a location (like ``/usr/local``) that requires higher
100 permissions, you may need to run the last command with :command:`sudo`.
100 permissions, you may need to run the last command with :command:`sudo`.
101
101
102 Windows
102 Windows
103 -------
103 -------
104
104
105 As mentioned above, on Windows, IPython requires :mod:`distribute`, and it also
105 As mentioned above, on Windows, IPython requires :mod:`distribute`, and it also
106 requires the PyReadline library to properly support coloring and keyboard
106 requires the PyReadline library to properly support coloring and keyboard
107 management (features that the default windows console doesn't have). So on
107 management (features that the default windows console doesn't have). So on
108 Windows, the installation procedure is:
108 Windows, the installation procedure is:
109
109
110 1. Install `distribute <http://pypi.python.org/pypi/distribute>`_.
110 1. Install `distribute <http://pypi.python.org/pypi/distribute>`_.
111
111
112 2. Install `pyreadline <http://pypi.python.org/pypi/pyreadline>`_. You can use
112 2. Install `pyreadline <http://pypi.python.org/pypi/pyreadline>`_. You can use
113 the command ``easy_install pyreadline`` from a terminal, or the binary
113 the command ``easy_install pyreadline`` from a terminal, or the binary
114 installer appropriate for your platform from the PyPI page.
114 installer appropriate for your platform from the PyPI page.
115
115
116 3. Install IPython itself, which you can download from `PyPI
116 3. Install IPython itself, which you can download from `PyPI
117 <http://pypi.python.org/pypi/ipython>`_ or from `our site
117 <http://pypi.python.org/pypi/ipython>`_ or from `our site
118 <http://ipython.org/download.html>`_. Note that on Windows 7, you *must*
118 <http://ipython.org/download.html>`_. Note that on Windows 7, you *must*
119 right-click and 'Run as administrator' for the Start menu shortcuts to be
119 right-click and 'Run as administrator' for the Start menu shortcuts to be
120 created.
120 created.
121
121
122 IPython by default runs in a terminal window, but the normal terminal
122 IPython by default runs in a terminal window, but the normal terminal
123 application supplied by Microsoft Windows is very primitive. You may want to
123 application supplied by Microsoft Windows is very primitive. You may want to
124 download the excellent and free Console_ application instead, which is a far
124 download the excellent and free Console_ application instead, which is a far
125 superior tool. You can even configure Console to give you by default an
125 superior tool. You can even configure Console to give you by default an
126 IPython tab, which is very convenient to create new IPython sessions directly
126 IPython tab, which is very convenient to create new IPython sessions directly
127 from the working terminal.
127 from the working terminal.
128
128
129 .. _Console: http://sourceforge.net/projects/console
129 .. _Console: http://sourceforge.net/projects/console
130
130
131
131
132 Installing the development version
132 Installing the development version
133 ----------------------------------
133 ----------------------------------
134
134
135 It is also possible to install the development version of IPython from our
135 It is also possible to install the development version of IPython from our
136 `Git <http://git-scm.com/>`_ source code repository. To do this you will
136 `Git <http://git-scm.com/>`_ source code repository. To do this you will
137 need to have Git installed on your system. Then just do:
137 need to have Git installed on your system. Then just do:
138
138
139 .. code-block:: bash
139 .. code-block:: bash
140
140
141 $ git clone https://github.com/ipython/ipython.git
141 $ git clone https://github.com/ipython/ipython.git
142 $ cd ipython
142 $ cd ipython
143 $ python setup.py install
143 $ python setup.py install
144
144
145 Some users want to be able to follow the development branch as it changes. If
145 Some users want to be able to follow the development branch as it changes. If
146 you have :mod:`distribute` installed, this is easy. Simply replace the last
146 you have :mod:`distribute` installed, this is easy. Simply replace the last
147 step by:
147 step by:
148
148
149 .. code-block:: bash
149 .. code-block:: bash
150
150
151 $ python setupegg.py develop
151 $ python setupegg.py develop
152
152
153 This creates links in the right places and installs the command line script to
153 This creates links in the right places and installs the command line script to
154 the appropriate places. Then, if you want to update your IPython at any time,
154 the appropriate places. Then, if you want to update your IPython at any time,
155 just do:
155 just do:
156
156
157 .. code-block:: bash
157 .. code-block:: bash
158
158
159 $ git pull
159 $ git pull
160
160
161
161
162 Basic optional dependencies
162 Basic optional dependencies
163 ===========================
163 ===========================
164
164
165 There are a number of basic optional dependencies that most users will want to
165 There are a number of basic optional dependencies that most users will want to
166 get. These are:
166 get. These are:
167
167
168 * readline (for command line editing, tab completion, etc.)
168 * readline (for command line editing, tab completion, etc.)
169 * nose (to run the IPython test suite)
169 * nose (to run the IPython test suite)
170 * pexpect (to use things like irunner)
170 * pexpect (to use things like irunner)
171
171
172 If you are comfortable installing these things yourself, have at it, otherwise
172 If you are comfortable installing these things yourself, have at it, otherwise
173 read on for more details.
173 read on for more details.
174
174
175 readline
175 readline
176 --------
176 --------
177
177
178 As indicated above, on Windows, PyReadline is a *mandatory* dependency.
178 As indicated above, on Windows, PyReadline is a *mandatory* dependency.
179 PyReadline is a separate, Windows only implementation of readline that uses
179 PyReadline is a separate, Windows only implementation of readline that uses
180 native Windows calls through :mod:`ctypes`. The easiest way of installing
180 native Windows calls through :mod:`ctypes`. The easiest way of installing
181 PyReadline is you use the binary installer available `here
181 PyReadline is you use the binary installer available `here
182 <http://pypi.python.org/pypi/pyreadline>`_.
182 <http://pypi.python.org/pypi/pyreadline>`_.
183
183
184 On OSX, if you are using the built-in Python shipped by Apple, you will be
184 On OSX, if you are using the built-in Python shipped by Apple, you will be
185 missing a full readline implementation as Apple ships instead a library called
185 missing a full readline implementation as Apple ships instead a library called
186 ``libedit`` that provides only some of readline's functionality. While you may
186 ``libedit`` that provides only some of readline's functionality. While you may
187 find libedit sufficient, we have occasional reports of bugs with it and several
187 find libedit sufficient, we have occasional reports of bugs with it and several
188 developers who use OS X as their main environment consider libedit unacceptable
188 developers who use OS X as their main environment consider libedit unacceptable
189 for productive, regular use with IPython.
189 for productive, regular use with IPython.
190
190
191 Therefore, we *strongly* recommend that on OS X you get the full
191 Therefore, we *strongly* recommend that on OS X you get the full
192 :mod:`readline` module. We will *not* consider completion/history problems to
192 :mod:`readline` module. We will *not* consider completion/history problems to
193 be bugs for IPython if you are using libedit.
193 be bugs for IPython if you are using libedit.
194
194
195 To get a working :mod:`readline` module, just do (with :mod:`distribute`
195 To get a working :mod:`readline` module, just do (with :mod:`distribute`
196 installed):
196 installed):
197
197
198 .. code-block:: bash
198 .. code-block:: bash
199
199
200 $ easy_install readline
200 $ easy_install readline
201
201
202 .. note::
202 .. note::
203
203
204 Other Python distributions on OS X (such as fink, MacPorts and the official
204 Other Python distributions on OS X (such as fink, MacPorts and the official
205 python.org binaries) already have readline installed so you likely don't
205 python.org binaries) already have readline installed so you likely don't
206 have to do this step.
206 have to do this step.
207
207
208 When IPython is installed with :mod:`distribute`, (e.g. using the
208 When IPython is installed with :mod:`distribute`, (e.g. using the
209 ``easy_install`` command), readline is added as a dependency on OS X, and
209 ``easy_install`` command), readline is added as a dependency on OS X, and
210 PyReadline on Windows, and will be installed on your system. However, if you
210 PyReadline on Windows, and will be installed on your system. However, if you
211 do not use distribute, you may have to install one of these packages yourself.
211 do not use distribute, you may have to install one of these packages yourself.
212
212
213
213
214 nose
214 nose
215 ----
215 ----
216
216
217 To run the IPython test suite you will need the :mod:`nose` package. Nose
217 To run the IPython test suite you will need the :mod:`nose` package. Nose
218 provides a great way of sniffing out and running all of the IPython tests. The
218 provides a great way of sniffing out and running all of the IPython tests. The
219 simplest way of getting nose, is to use :command:`easy_install`:
219 simplest way of getting nose, is to use :command:`easy_install`:
220
220
221 .. code-block:: bash
221 .. code-block:: bash
222
222
223 $ easy_install nose
223 $ easy_install nose
224
224
225 Another way of getting this is to do:
225 Another way of getting this is to do:
226
226
227 .. code-block:: bash
227 .. code-block:: bash
228
228
229 $ easy_install ipython[test]
229 $ easy_install ipython[test]
230
230
231 For more installation options, see the `nose website
231 For more installation options, see the `nose website
232 <http://somethingaboutorange.com/mrl/projects/nose/>`_.
232 <http://somethingaboutorange.com/mrl/projects/nose/>`_.
233
233
234 Once you have nose installed, you can run IPython's test suite using the
234 Once you have nose installed, you can run IPython's test suite using the
235 iptest command:
235 iptest command:
236
236
237 .. code-block:: bash
237 .. code-block:: bash
238
238
239 $ iptest
239 $ iptest
240
240
241 pexpect
241 pexpect
242 -------
242 -------
243
243
244 The pexpect_ package is used in IPython's :command:`irunner` script, as well as
244 The pexpect_ package is used in IPython's :command:`irunner` script, as well as
245 for managing subprocesses. IPython now includes a version of pexpect in
245 for managing subprocesses. IPython now includes a version of pexpect in
246 :mod:`IPython.external`, but if you have installed pexpect, IPython will use
246 :mod:`IPython.external`, but if you have installed pexpect, IPython will use
247 that instead. On Unix platforms (including OS X), just do:
247 that instead. On Unix platforms (including OS X), just do:
248
248
249 .. code-block:: bash
249 .. code-block:: bash
250
250
251 $ easy_install pexpect
251 $ easy_install pexpect
252
252
253 Windows users are out of luck as pexpect does not run there.
253 Windows users are out of luck as pexpect does not run there.
254
254
255 Dependencies for IPython.parallel (parallel computing)
255 Dependencies for IPython.parallel (parallel computing)
256 ======================================================
256 ======================================================
257
257
258 :mod:`IPython.kernel` has been replaced by :mod:`IPython.parallel`,
258 :mod:`IPython.kernel` has been replaced by :mod:`IPython.parallel`,
259 which uses ZeroMQ for all communication.
259 which uses ZeroMQ for all communication.
260
260
261 IPython.parallel provides a nice architecture for parallel computing, with a
261 IPython.parallel provides a nice architecture for parallel computing, with a
262 focus on fluid interactive workflows. These features require just one package:
262 focus on fluid interactive workflows. These features require just one package:
263 PyZMQ. See the next section for PyZMQ details.
263 PyZMQ. See the next section for PyZMQ details.
264
264
265 On a Unix style platform (including OS X), if you want to use
265 On a Unix style platform (including OS X), if you want to use
266 :mod:`distribute`, you can just do:
266 :mod:`distribute`, you can just do:
267
267
268 .. code-block:: bash
268 .. code-block:: bash
269
269
270 $ easy_install ipython[zmq] # will include pyzmq
270 $ easy_install ipython[zmq] # will include pyzmq
271
271
272 Security in IPython.parallel is provided by SSH tunnels. By default, Linux
272 Security in IPython.parallel is provided by SSH tunnels. By default, Linux
273 and OSX clients will use the shell ssh command, but on Windows, we also
273 and OSX clients will use the shell ssh command, but on Windows, we also
274 support tunneling with paramiko_.
274 support tunneling with paramiko_.
275
275
276 Dependencies for IPython.zmq
276 Dependencies for IPython.zmq
277 ============================
277 ============================
278
278
279 pyzmq
279 pyzmq
280 -----
280 -----
281
281
282 IPython 0.11 introduced some new functionality, including a two-process
282 IPython 0.11 introduced some new functionality, including a two-process
283 execution model using ZeroMQ_ for communication. The Python bindings to ZeroMQ
283 execution model using ZeroMQ_ for communication. The Python bindings to ZeroMQ
284 are found in the PyZMQ_ project, which is easy_install-able once you have
284 are found in the PyZMQ_ project, which is easy_install-able once you have
285 ZeroMQ installed. If you are on Python 2.6 or 2.7 on OSX, or 2.7 on Windows,
285 ZeroMQ installed. If you are on Python 2.6 or 2.7 on OSX, or 2.7 on Windows,
286 pyzmq has eggs that include ZeroMQ itself.
286 pyzmq has eggs that include ZeroMQ itself.
287
287
288 IPython.zmq depends on pyzmq >= 2.1.4.
288 IPython.zmq depends on pyzmq >= 2.1.4.
289
289
290 Dependencies for the IPython QT console
290 Dependencies for the IPython QT console
291 =======================================
291 =======================================
292
292
293 pyzmq
293 pyzmq
294 -----
294 -----
295
295
296 Like the :mod:`IPython.parallel` package, the QT Console requires ZeroMQ and
296 Like the :mod:`IPython.parallel` package, the QT Console requires ZeroMQ and
297 PyZMQ.
297 PyZMQ.
298
298
299 Qt
299 Qt
300 --
300 --
301
301
302 Also with 0.11, a new GUI was added using the work in :mod:`IPython.zmq`, which
302 Also with 0.11, a new GUI was added using the work in :mod:`IPython.zmq`, which
303 can be launched with ``ipython qtconsole``. The GUI is built on Qt, and works
303 can be launched with ``ipython qtconsole``. The GUI is built on Qt, and works
304 with either PyQt, which can be installed from the `PyQt website
304 with either PyQt, which can be installed from the `PyQt website
305 <http://www.riverbankcomputing.co.uk/>`_, or `PySide
305 <http://www.riverbankcomputing.co.uk/>`_, or `PySide
306 <http://www.pyside.org/>`_, from Nokia.
306 <http://www.pyside.org/>`_, from Nokia.
307
307
308 pygments
308 pygments
309 --------
309 --------
310
310
311 The syntax-highlighting in ``ipython qtconsole`` is done with the pygments_
311 The syntax-highlighting in ``ipython qtconsole`` is done with the pygments_
312 project, which is easy_install-able.
312 project, which is easy_install-able.
313
313
314 .. _installnotebook:
314 .. _installnotebook:
315
315
316 Dependencies for the IPython HTML notebook
316 Dependencies for the IPython HTML notebook
317 ==========================================
317 ==========================================
318
318
319 The IPython notebook is a notebook-style web interface to IPython and can be
319 The IPython notebook is a notebook-style web interface to IPython and can be
320 started withe command ``ipython notebook``.
320 started withe command ``ipython notebook``.
321
321
322 pyzmq
322 pyzmq
323 -----
323 -----
324
324
325 Like the :mod:`IPython.parallel` and :mod:`IPython.frontend.qt.console`
325 Like the :mod:`IPython.parallel` and :mod:`IPython.frontend.qt.console`
326 packages, the HTML notebook requires ZeroMQ and PyZMQ.
326 packages, the HTML notebook requires ZeroMQ and PyZMQ.
327
327
328 Tornado
328 Tornado
329 -------
329 -------
330
330
331 The IPython notebook uses the Tornado_ project for its HTTP server. Tornado 2.1
331 The IPython notebook uses the Tornado_ project for its HTTP server. Tornado 2.1
332 is required, in order to support current versions of browsers, due to an update
332 is required, in order to support current versions of browsers, due to an update
333 to the websocket protocol.
333 to the websocket protocol.
334
334
335
335
336 MathJax
336 MathJax
337 -------
337 -------
338
338
339 The IPython notebook uses the MathJax_ Javascript library for rendering LaTeX
339 The IPython notebook uses the MathJax_ Javascript library for rendering LaTeX
340 in web browsers. Because MathJax is large, we don't include it with
340 in web browsers. Because MathJax is large, we don't include it with
341 IPython. Normally IPython will load MathJax from a CDN, but if you have a slow
341 IPython. Normally IPython will load MathJax from a CDN, but if you have a slow
342 network connection, or want to use LaTeX without an internet connection at all,
342 network connection, or want to use LaTeX without an internet connection at all,
343 you can install MathJax locally.
343 you can install MathJax locally.
344
344
345 A quick and easy method is to install it from a python session::
345 A quick and easy method is to install it from a python session::
346
346
347 from IPython.external.mathjax import install_mathjax
347 from IPython.external.mathjax import install_mathjax
348 install_mathjax()
348 install_mathjax()
349
349
350 If you need tighter configuration control, you can download your own copy
350 If you need tighter configuration control, you can download your own copy
351 of MathJax from http://www.mathjax.org/download/ - use the MathJax-1.1 link.
351 of MathJax from http://www.mathjax.org/download/ - use the MathJax-2.0 link.
352 When you have the file stored locally, install it with::
352 When you have the file stored locally, install it with::
353
353
354 python -m IPython.external.mathjax /path/to/source/mathjax-MathJax-v1.1-0-g5a7e4d7.zip
354 python -m IPython.external.mathjax /path/to/source/mathjax-MathJax-v2.0-20-g07669ac.zip
355
355
356 For unusual needs, IPython can tell you what directory it wants to find MathJax in::
356 For unusual needs, IPython can tell you what directory it wants to find MathJax in::
357
357
358 python -m IPython.external.mathjax -d
358 python -m IPython.external.mathjax -d
359
359
360 By default Mathjax will be installed in your ipython profile directory, but you
360 By default Mathjax will be installed in your ipython profile directory, but you
361 can make system wide install, please refere to the documentation and helper function
361 can make system wide install, please refere to the documentation and helper function
362 of IPython.external.mathjax
362 of IPython.external.mathjax
363
363
364 Browser Compatibility
364 Browser Compatibility
365 ---------------------
365 ---------------------
366
366
367 The notebook uses WebSockets and the flexible box model. These features are
367 The notebook uses WebSockets and the flexible box model. These features are
368 available in the following browsers:
368 available in the following browsers:
369
369
370 * Chrome
370 * Chrome
371 * Safari
371 * Safari
372 * Firefox 6 and above
372 * Firefox 6 and above
373 * Firefox 4 and 5: These browsers have WebSocket support, but it is disabled by
373 * Firefox 4 and 5: These browsers have WebSocket support, but it is disabled by
374 default. If you're unable to upgrade, you can enable it by entering ``about:config``
374 default. If you're unable to upgrade, you can enable it by entering ``about:config``
375 in the URL bar and then setting ``network.websocket.enabled`` and
375 in the URL bar and then setting ``network.websocket.enabled`` and
376 ``network.websocket.override-security-block`` to ``true``.
376 ``network.websocket.override-security-block`` to ``true``.
377
377
378 Internet Explorer 9 does not support WebSockets or the flexible box model, but
378 Internet Explorer 9 does not support WebSockets or the flexible box model, but
379 these features should appear in Internet Explorer 10.
379 these features should appear in Internet Explorer 10.
380
380
381
381
382 .. _ZeroMQ: http://www.zeromq.org
382 .. _ZeroMQ: http://www.zeromq.org
383 .. _PyZMQ: https://github.com/zeromq/pyzmq
383 .. _PyZMQ: https://github.com/zeromq/pyzmq
384 .. _paramiko: https://github.com/robey/paramiko
384 .. _paramiko: https://github.com/robey/paramiko
385 .. _pygments: http://pygments.org
385 .. _pygments: http://pygments.org
386 .. _pexpect: http://www.noah.org/wiki/Pexpect
386 .. _pexpect: http://www.noah.org/wiki/Pexpect
387 .. _Tornado: http://www.tornadoweb.org
387 .. _Tornado: http://www.tornadoweb.org
388 .. _MathJax: http://www.mathjax.org
388 .. _MathJax: http://www.mathjax.org
General Comments 0
You need to be logged in to leave comments. Login now