# FYI: Julia for Linux on 'Bash for Windows'

**URL:** <https://discourse.julialang.org/t/fyi-julia-for-linux-on-bash-for-windows/3096>\
**Category:** General Usage\
**Created:** [April 6, 2017, 10:06pm UTC](https://discourse.julialang.org/t/fyi-julia-for-linux-on-bash-for-windows/3096 "2017-04-06T22:06:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![m-j-w](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/m-j-w/32/4541_2.png) [@m-j-w](https://discourse.julialang.org/u/m-j-w)\
**Post date:** [April 6, 2017, 10:06pm UTC](https://discourse.julialang.org/t/fyi-julia-for-linux-on-bash-for-windows/3096/1 "2017-04-06T22:06:08Z")

</div>

Since Windows 10 1703 ([Creators Update, available since April 6th 2017 or so](https://blogs.windows.com/windowsexperience/2017/03/30/managing-windows-10-creators-update-rollout-seamless-experience/#7f5ITtwDqERAGzUR.97)) ,the Windows-Subsystem-Linux (WSL) provides the opportunity to use a fully featured Linux environment natively on Windows. Although in principle available since roughly two years, the _Creators Update_ resolves the previously lacking symbolic links capability on Windows and allows an update to _Ubuntu Xenial 16.04_.

Consequently, one may also choose to run the Linux version of Julia on Windows, _potentially_ giving a richer development experience.

Note that WSL is not a virtual machine; the Linux kernel functions are directly mapped to the Windows kernel, thereby allowing essentially any native Linux binary to be directly run on Windows – as long as it doesn’t require X windows. Luckily, Julia has an excellent REPL for the terminal.

Take a look at the detailed description of [Bash on Ubuntu on Windows (Microsoft Developer Network)](https://msdn.microsoft.com/de-de/commandline/wsl)

## Make it so…

#### Requirements

- Windows 10 (64-bit) version 1703 (Creators Update) or newer, and
- Local administrator priviledges to install _Bash on Windows_, or
- already installed _Bash on Windows_ with _Ubuntu Xenial 16.04_ or newer.

#### Installation

1. Follow the [Installation Guide](https://msdn.microsoft.com/de-de/commandline/wsl/install_guide) of _Bash on Windows_.

2. Verify that you have _Ubuntu Xenial 16.04_ installed by opening _Bash on Windows_ from the start menu and type

3. Download and extract the _Julia_ archive to your user’s home directory, here we choose the [Generic Linux Binaries](https://julialang.org/downloads/) of _Julia 0.5.1_:

## Energize…

There should now be a subdirectory starting with `julia-` and followed by the Git commit hash of the release. Here, we assume this exact directory name is `julia-6445c82d00`.

```sh
user@host:~$ ls -d julia-*
julia-0.5.1-linux-x86_64.tar.gz* julia-6445c82d00/

```

Now it’s time to start the Julia REPL

```sh
user@host:~$ julia-6445c82d00/bin/julia

```

and see the magic happen:

```plaintext
               _
   _ _ _(_)_ | A fresh approach to technical computing
  (_) | (_) (_) | Documentation: http://docs.julialang.org
   _ _ _| |_ __ _ | Type "?help" for help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 0.5.1 (2017-03-05 13:25 UTC)
 _/ |\ __'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu

julia> peakflops()
1.9908520348996365e10

julia> versioninfo()
Julia Version 0.5.1
Commit 6445c82 (2017-03-05 13:25 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, sandybridge)

julia> 1+2
3

julia>

```

Hit `<CTRL>+D` to exit Julia.

## Engage…

To make sure everything is alright, let’s run the full Julia test suite.  
Unfortunately, there seems to be some issue regarding multi-threading, so  
lets fall back to single core:

```jl
help?> Base.runtests
  runtests([tests=["all"] [, numcores=ceil(Integer, Sys.CPU_CORES / 2)]])

  Run the Julia unit tests listed in tests, which can be either a string or
  an array of strings, using numcores processors. (not exported)

julia> Base.runtests("all", 0)
     * linalg/triangular in 343.51 seconds, maxrss 637.77 MB
     * linalg/qr in 61.01 seconds, maxrss 749.48 MB
     * linalg/dense in 31.24 seconds, maxrss 784.41 MB
     * linalg/matmul in 125.35 seconds, maxrss 852.55 MB
     * linalg/schur in 6.61 seconds, maxrss 862.48 MB
     * linalg/special in 2.57 seconds, maxrss 869.45 MB
     * linalg/eigen in 26.10 seconds, maxrss 880.37 MB
     * linalg/bunchkaufman in 18.99 seconds, maxrss 887.07 MB
     * linalg/svd in 11.31 seconds, maxrss 898.15 MB
     * linalg/lapack in 30.40 seconds, maxrss 907.11 MB
     * linalg/tridiag in 23.49 seconds, maxrss 907.44 MB
     * linalg/bidiag in 22.15 seconds, maxrss 921.24 MB
     * linalg/diagonal in 32.28 seconds, maxrss 928.46 MB
     * linalg/pinv in 6.56 seconds, maxrss 1014.12 MB
     * linalg/givens in 5.54 seconds, maxrss 1014.12 MB
     * linalg/cholesky in 22.80 seconds, maxrss 1014.12 MB
     * linalg/lu in 24.52 seconds, maxrss 1014.12 MB
     * linalg/symmetric in 11.90 seconds, maxrss 1014.12 MB
     * linalg/generic in 7.63 seconds, maxrss 1014.23 MB
     * linalg/uniformscaling in 34.96 seconds, maxrss 1017.74 MB
     * linalg/lq in 43.18 seconds, maxrss 1048.18 MB
     * linalg/hessenberg in 0.89 seconds, maxrss 1048.48 MB
     * linalg/arnoldi in 30.30 seconds, maxrss 1052.84 MB
     * subarray in 391.72 seconds, maxrss 1402.90 MB
     * core in 70.38 seconds, maxrss 2548.99 MB
     * inference in 0.97 seconds, maxrss 2548.99 MB
     * keywordargs in 2.10 seconds, maxrss 2548.99 MB
     * numbers in 136.61 seconds, maxrss 2548.99 MB
     * printf in 19.77 seconds, maxrss 2548.99 MB
     * char in 1.58 seconds, maxrss 2548.99 MB
     * string in 27.48 seconds, maxrss 2548.99 MB
     * triplequote in 0.03 seconds, maxrss 2548.99 MB
     * unicode in 5.13 seconds, maxrss 2548.99 MB
     * dates in 54.40 seconds, maxrss 2548.99 MB
     * dict in 15.71 seconds, maxrss 2548.99 MB
     * hashing in 6.90 seconds, maxrss 2548.99 MB
     * iobuffer in 1.10 seconds, maxrss 2548.99 MB
     * staged in 1.71 seconds, maxrss 2548.99 MB
     * offsetarray in 99.84 seconds, maxrss 2548.99 MB
     * arrayops in 48.48 seconds, maxrss 2548.99 MB
     * tuple in 2.51 seconds, maxrss 2548.99 MB
     * reduce in 4.98 seconds, maxrss 2548.99 MB
     * reducedim in 16.75 seconds, maxrss 2548.99 MB
     * random in 14.81 seconds, maxrss 2548.99 MB
     * abstractarray in 129.88 seconds, maxrss 2548.99 MB
     * intfuncs in 1.36 seconds, maxrss 2548.99 MB
     * simdloop in 1.77 seconds, maxrss 2548.99 MB
     * vecelement in 2.76 seconds, maxrss 2548.99 MB
     * blas in 40.38 seconds, maxrss 2548.99 MB
     * sparse in 362.34 seconds, maxrss 2548.99 MB
     * bitarray in 669.47 seconds, maxrss 2548.99 MB
     * copy in 2.11 seconds, maxrss 2548.99 MB
     * math in 52.24 seconds, maxrss 2548.99 MB
     * fastmath in 3.75 seconds, maxrss 2548.99 MB
     * functional in 36.97 seconds, maxrss 2548.99 MB
     * operators in 0.66 seconds, maxrss 2548.99 MB
     * path in 5.38 seconds, maxrss 2548.99 MB
     * ccall in 7.28 seconds, maxrss 2548.99 MB
     * parse in 3.61 seconds, maxrss 2548.99 MB
     * loading in 0.12 seconds, maxrss 2548.99 MB
     * bigint in 5.41 seconds, maxrss 2548.99 MB
     * bigfloat in 0.14 seconds, maxrss 2548.99 MB
     * sorting in 45.76 seconds, maxrss 2548.99 MB
     * statistics in 8.42 seconds, maxrss 2548.99 MB
     * spawn [stdio passthrough ok]
Test Failed
  Expression: run(@cmd("foo_is_not_a_valid_command"))
    Expected: Base.UVError
      Thrown: ErrorException
ERROR: LoadError: LoadError: There was an error during testing
 in record(::Base.Test.FallbackTestSet, ::Base.Test.Fail) at test.jl:397
 in do_test_throws(::Base.Test.Threw, ::Expr, ::Type{T}) at test.jl:329
 in include_from_node1(::String) at loading.jl:488
 in macro expansion at util.jl:230 [inlined]

```

Well, not exactly super fast on a 2nd gen mobile Core i5, and certainly `libuv` requires some patches, but still:

_Quod erat demonstrandum._

---

<div class="post-metadata">

**Author:** ![miguelraz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miguelraz/32/631_2.png) [@miguelraz](https://discourse.julialang.org/u/miguelraz)\
**Post date:** [April 7, 2017, 3:21am UTC](https://discourse.julialang.org/t/fyi-julia-for-linux-on-bash-for-windows/3096/2 "2017-04-07T03:21:11Z")

</div>

Can confirm - got Julia v.0.6 on Window’s Bash.  
_Brrr…_

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [April 7, 2017, 7:00pm UTC](https://discourse.julialang.org/t/fyi-julia-for-linux-on-bash-for-windows/3096/3 "2017-04-07T19:00:01Z")

</div>

I just wish they would fix [this bug](https://github.com/Microsoft/BashOnWindows/issues/544), so that one can compile julia in bash, but use a normal editor on windows to edit files…
