Skip to content

JuliaCustom

Marcelo Forets edited this page May 26, 2017 · 8 revisions

The following are steps how to setup a custom installation of Julia on Cocalc

  1. Get a 64 bit linux tarball: https://julialang.org/downloads/ From a Terminal file in your project:

    $ cd ~
    $ wget "https://julialang-s3.julialang.org/bin/linux/x64/0.5/julia-0.5.2-linux-x86_64.tar.gz"
    

    adjusting the link if necessary.

  2. Extract it, and symlink from your ~/bin/julia to it's bin/julia:

    $ tar -xzvf julia-0.5.2-linux-x86_64.tar.gz
    $ cd; mkdir bin; cd bin
    $ ln -s ~/<extracted-tarball-dir>/bin/julia julia
    
  3. Make sure ~/bin is in your PATH, e.g. by appending export PATH=$HOME/bin:$HOME/.local/bin:$PATH to your ~/.bashrc file.

    $ echo export PATH=$HOME/bin:$HOME/.local/bin:$PATH >> ~/.bashrc
    
  4. Tell Julia to use a package directory inside your project, add this line to your ~/.bashrc: export JULIA_PKGDIR=$HOME/.julia

    $ echo export JULIA_PKGDIR=$HOME/.julia >> ~/.bashrc
    
  5. Restart the terminal and test you got the correct julia:

    ~$ which julia
    /projects/<your-project-uuid>/bin/julia
    ~$ julia --version
    julia version 0.5.2
    ~$ echo $JULIA_PKGDIR
    /projects/<your-project-uuid>/.julia
    
  6. For running Julia in the Jupyter Notebook, you also need to install IJulia and your own jupyter kernel:

    $ julia
    > Pkg.init()
    > Pkg.add("IJulia")
    
  7. This should automatically add a kernel file at ~/.local/share/jupyter/kernels/julia-XXX/kernel.json containing information like this. You have to add the JULIA_PKGDIR env variable:

{
  "display_name": "Julia (XXX)",
  "argv": [
    "/projects/<YOUR-PROJECT-UUID>/bin/julia",
    "-i",
    "--startup-file=yes",
    "--color=yes",
    "/projects/<YOUR-PROJECT-UUID>/.julia/v0.5/IJulia/src/kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {
      "JULIA_PKGDIR": "/projects/<YOUR-PROJECT-UUID>/.julia"
  }
}

(and don't forget the comma after "language": "julia")

Hence, after maybe refreshing the kernel list, an entry "Julia (XXX)" should show up.

Clone this wiki locally