Julia - gher-uliege/Documentation GitHub Wiki

Home page: http://julialang.org/
Source code: https://github.com/JuliaLang/julia

Installation

Julia is available at http://julialang.org/downloads/

Anaconda: https://www.continuum.io/downloads

From source (only if you do not want the precompiled version mentioned above)

git clone [email protected]:JuliaLang/julia.git
git checkout release-x.y
make
  • release-x.y may have to be adapted, according to the most recent stable version.
  • make can take a while (i.e., hours) to be completed.
  • You need to have a recent version of cmake.

Package management

A complete guide is available at https://pkgdocs.julialang.org/v1/managing-packages/:

  • Summary of the packages installed:
using Pkg
Pkg.status()
  • Add new:
using Pkg
Pkg.add("NewPackageName")
  • Install from github:
]add package_name#master
  • Get the latest versions of your packages (or a single package):
]up package_name
  • Make a package available for development.
]dev package_name

Running Julia

Command line

Open a terminal and type

julia

now issue the Julia commands:

julia> exp(sin(pi))
1.0000000000000002

Notebook

Check this page: https://github.com/JuliaLang/IJulia.jl

In terminal, start Julia then type

using Pkg
Pkg.add("IJulia")

Next time you launch a jupyter notebook, the Julia kernel corresponding to your Julia version will appear. Other possibility: directly from Julia terminal:

julia> using IJulia
julia> notebook()

Updating Julia

  • download binaries and install as usual in your OS.
  • Run in Julia (not IJulia of Jupyter)
using Pkg
Pkg.build("IJulia") # patch version upgrade, e.g. 1.6.0 -> 1.6.1
Pkg.add("IJulia") # minor version upgrade, e.g. 1.6.3 -> 1.7.0

Then in IJulia or Julia:

using Pkg
Pkg.update()

To use DIVAnd

If you want to use DIVAnd

Pkg.add("DIVAnd")

or if you have a local working/development copy

]dev DIVAnd

Alex's introduction to Julia with Jupyter: http://tinyurl.com/juliatut

Recommanded packages

General documentation for the packages: http://docs.julialang.org/en/release-0.4/manual/packages/

Testing

Addition information on testing julia code.

Troubleshooting

Using PyPlot

Error message:

The pyimport exception was: PyError (:PyImport_ImportModule) <type 'exceptions.ImportError'>
ImportError('No module named matplotlib',)

**Solution**:

`pip3 install matplotlib`