|
| 1 | +# Installation |
| 2 | + |
| 3 | + |
| 4 | +## Installing IJulia |
| 5 | + |
| 6 | +First, [download Julia](http://julialang.org/downloads/) *version 0.7 |
| 7 | +or later* and run the installer. Then run the Julia application |
| 8 | +(double-click on it); a window with a `julia>` prompt will appear. At |
| 9 | +the prompt, type: |
| 10 | +```julia |
| 11 | +using Pkg |
| 12 | +Pkg.add("IJulia") |
| 13 | +``` |
| 14 | +to install IJulia. |
| 15 | + |
| 16 | +This process installs a [kernel specification](https://jupyter-client.readthedocs.io/en/latest/kernels.html#kernelspecs) that tells Jupyter (or JupyterLab) etcetera |
| 17 | +how to launch Julia. |
| 18 | + |
| 19 | +`Pkg.add("IJulia")` does not actually install Jupyter itself. |
| 20 | +You can install Jupyter if you want, but it can also be installed |
| 21 | +automatically when you run `IJulia.notebook()` below. (You |
| 22 | +can force it to use a specific `jupyter` installation by |
| 23 | +setting `ENV["JUPYTER"]` to the path of the `jupyter` program |
| 24 | +before `Pkg.add`, or before running `Pkg.build("IJulia")`; |
| 25 | +your preference is remembered on subsequent updates. |
| 26 | + |
| 27 | + |
| 28 | +## Updating Julia and IJulia |
| 29 | + |
| 30 | +Julia is improving rapidly, so it won't be long before you want to |
| 31 | +update to a more recent version. To update the packages only, keeping |
| 32 | +Julia itself the same, just run: |
| 33 | +```julia |
| 34 | +Pkg.update() |
| 35 | +``` |
| 36 | +at the Julia prompt (or in IJulia). |
| 37 | + |
| 38 | +If you download and install a new version of Julia from the Julia web |
| 39 | +site, you will also probably want to update the packages with |
| 40 | +`Pkg.update()` (in case newer versions of the packages are required |
| 41 | +for the most recent Julia). In any case, if you install a new Julia |
| 42 | +binary (or do anything that *changes the location of Julia* on your |
| 43 | +computer), you *must* update the IJulia installation (to tell Jupyter |
| 44 | +where to find the new Julia) by running |
| 45 | +```julia |
| 46 | +Pkg.build("IJulia") |
| 47 | +``` |
| 48 | +at the Julia command line (**important**: not in IJulia). |
| 49 | + |
| 50 | + |
| 51 | +## Installing additional Julia kernels |
| 52 | + |
| 53 | +You can also install additional Julia kernels, for example, to |
| 54 | +pass alternative command-line arguments to the `julia` executable, |
| 55 | +by using the `IJulia.installkernel` function. See the help for this |
| 56 | +function (`? IJulia.installkernel` in Julia) for complete details. |
| 57 | + |
| 58 | +For example, if you want to run Julia with all deprecation warnings |
| 59 | +disabled, you can do: |
| 60 | +```julia |
| 61 | +using IJulia |
| 62 | +installkernel("Julia nodeps", "--depwarn=no") |
| 63 | +``` |
| 64 | +and a kernel called `Julia nodeps 0.7` (if you are using Julia 0.7) |
| 65 | +will be installed (will show up in your main Jupyter kernel menu) that |
| 66 | +lets you open notebooks with this flag. |
| 67 | + |
| 68 | +You can also install kernels to run Julia with different environment |
| 69 | +variables, for example to set [`JULIA_NUM_THREADS`](https://docs.julialang.org/en/v1/manual/environment-variables/index.html#JULIA_NUM_THREADS-1) for use with Julia [multithreading](https://docs.julialang.org/en/v1/manual/parallel-computing/#Multi-Threading-(Experimental)-1): |
| 70 | +``` |
| 71 | +using IJulia |
| 72 | +installkernel("Julia (4 threads)", env=Dict("JULIA_NUM_THREADS"=>"4")) |
| 73 | +``` |
| 74 | +The `env` keyword should be a `Dict` mapping environment variables to values. |
| 75 | + |
| 76 | + |
| 77 | +## Low-level Information |
| 78 | + |
| 79 | +### Using older IPython versions |
| 80 | + |
| 81 | +While we strongly recommend using IPython version 3 or later (note that this |
| 82 | +has nothing to do with whether you use Python version 2 or 3), we recognize |
| 83 | +that in the short term some users may need to continue using IPython 2.x. You |
| 84 | +can do this by checkout out the `ipython2` branch of the IJulia package: |
| 85 | + |
| 86 | +```julia |
| 87 | +Pkg.checkout("IJulia", "ipython2") |
| 88 | +Pkg.build("IJulia") |
| 89 | +``` |
| 90 | + |
| 91 | +### Manual installation of IPython |
| 92 | + |
| 93 | +First, you will need to install a few prerequisites: |
| 94 | + |
| 95 | +* You need **version 3.0** or later of IPython, or version 4 or later |
| 96 | +of Jupyter. Note that IPython 3.0 was released in February 2015, so |
| 97 | +if you have an older operating system you may |
| 98 | +have to [install IPython |
| 99 | +manually](http://ipython.org/ipython-doc/stable/install/install.html). |
| 100 | +On Mac and Windows systems, it is currently easiest to use the |
| 101 | +[Anaconda Python](http://continuum.io/downloads) installer. |
| 102 | + |
| 103 | +* To use the [IPython notebook](http://ipython.org/notebook.html) interface, which runs in your web |
| 104 | + browser and provides a rich multimedia environment, you will need |
| 105 | + to install the [jsonschema](https://pypi.python.org/pypi/jsonschema), [Jinja2](http://jinja.pocoo.org/docs/), [Tornado](http://www.tornadoweb.org/en/stable/), |
| 106 | + and [pyzmq](https://github.com/zeromq/pyzmq) (requires `apt-get install libzmq-dev` and possibly `pip install --upgrade --force-reinstall pyzmq` on Ubuntu if you are using `pip`) Python packages. |
| 107 | + (Given the [pip](http://www.pip-installer.org/en/latest/) installer, `pip install jsonschema jinja2 tornado pyzmq` |
| 108 | + should normally be sufficient.) These should have been automatically installed if you installed IPython itself |
| 109 | + [via `easy_install` or `pip`](http://ipython.org/ipython-doc/stable/install/install.html#quickstart). |
| 110 | + |
| 111 | +* To use the [IPython qtconsole](http://ipython.org/ipython-doc/dev/interactive/qtconsole.html) interface, |
| 112 | + you will need to install [PyQt4](http://www.riverbankcomputing.com/software/pyqt/download) or |
| 113 | + [PySide](http://qt-project.org/wiki/Category:LanguageBindings::PySide). |
| 114 | + |
| 115 | +* You need Julia version 0.7 or later. |
| 116 | + |
| 117 | +Once IPython 3.0+ and Julia 0.7+ are installed, you can install IJulia from a Julia console by typing: |
| 118 | +```julia |
| 119 | +Pkg.add("IJulia") |
| 120 | +``` |
| 121 | +This will download IJulia and a few other prerequisites, and will set up a |
| 122 | +Julia kernel for IPython. |
| 123 | + |
| 124 | +If the command above returns an error, you may need to run `Pkg.update()`, then |
| 125 | +retry it, or possibly run `Pkg.build("IJulia")` to force a rebuild. |
0 commit comments