Julia

From GHER

(Difference between revisions)
Jump to: navigation, search
(Package managemebt)
(Package management)
Line 36: Line 36:
* Add new:
* Add new:
  Pkg.add(NewPackageName)
  Pkg.add(NewPackageName)
 +
* Install from github:
 +
Pkg.clone(URL);
* Get the latest versions of your packages:
* Get the latest versions of your packages:
  Pkg.update()
  Pkg.update()

Revision as of 08:55, 19 June 2017

Home page: http://julialang.org/

Source code: https://github.com/JuliaLang/julia

Contents

Installation

Proposed installation

Julia: http://julialang.org/downloads/

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

Then via

 Pkg.add("IJulia") 

etc in Julia add

 IJulia, Plots, Interpolations, PyPlot

From source

git clone git@github.com:JuliaLang/julia.git
git checkout release-0.5
make
  • release-0.5 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

  • Summary of the packages installed:
Pkg.status()
  • Summary, in dictionnary form:
Pkg.installed() 
  • Add new:
Pkg.add(NewPackageName)
  • Install from github:
Pkg.clone(URL);
  • Get the latest versions of your packages:
Pkg.update()

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

julia> 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()

To use divand

If you want to use divand

 Pkg.clone("https://github.com/gher-ulg/divand.jl")

or if you have a local working/development copy

 Pkg.clone("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/

Troubleshooting

Using PyPlot

Error message:

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

Origin: it seems Julia is looking for matplotlib in Python2.7. In my case I had it installed only with Python3.6.

Solution:

pip2.7 install matplotlib
Personal tools