installation

# Differences

This shows you the differences between two versions of the page.

 installation [2018/10/25 02:10]julia [Terminal Support] installation [2018/12/27 13:27] (current) Both sides previous revision Previous revision 2018/10/25 02:11 julia [Notes] 2018/10/25 02:10 julia [Terminal Support] 2018/10/25 02:09 julia [Starting Over from Scratch] 2018/10/25 02:09 julia [Startup: Loading A Standard Configuration File] 2018/10/25 02:05 julia [Logging Input and Output of an Interactive Session] 2018/10/25 02:02 julia [Reducing Long Vector Output on the REPL] 2018/10/25 02:02 julia [Reducing Long Vector Output on the REPL] 2018/10/25 02:01 julia [Suppressing Output] 2018/10/25 01:57 julia [Running a Julia file.jl Program from the REPL] 2018/10/25 01:56 julia [Interactive Use (REPL = Read-Eval-Print)] 2018/10/25 01:55 julia ['Hello World!' in Technicolor] 2018/10/25 01:54 julia [Interactive Use (REPL = Read-Eval-Print)] 2018/10/25 01:51 julia [Using Different Julia Versions on the Same Computer] 2018/10/25 01:50 julia [Invokation] 2018/10/25 01:48 julia [Using Different Julia Versions on the Same Computer] 2018/10/25 01:44 julia [Windows] 2018/10/25 01:24 julia [Linux] 2018/10/25 01:23 julia [First Julia Installation] 2018/10/25 01:23 julia [Installation] 2018/10/25 01:21 julia [Installation] 2018/10/25 01:21 julia [First Julia Installation] 2018/10/25 01:20 julia [MacOS] 2018/10/16 04:21 julia Add missing quotes2018/10/16 04:20 julia Update paths2018/10/15 09:42 external edit2018/09/24 10:23 ivo [Linux] 2018/08/28 12:44 external edit Next revision Previous revision 2018/10/25 02:11 julia [Notes] 2018/10/25 02:10 julia [Terminal Support] 2018/10/25 02:09 julia [Starting Over from Scratch] 2018/10/25 02:09 julia [Startup: Loading A Standard Configuration File] 2018/10/25 02:05 julia [Logging Input and Output of an Interactive Session] 2018/10/25 02:02 julia [Reducing Long Vector Output on the REPL] 2018/10/25 02:02 julia [Reducing Long Vector Output on the REPL] 2018/10/25 02:01 julia [Suppressing Output] 2018/10/25 01:57 julia [Running a Julia file.jl Program from the REPL] 2018/10/25 01:56 julia [Interactive Use (REPL = Read-Eval-Print)] 2018/10/25 01:55 julia ['Hello World!' in Technicolor] 2018/10/25 01:54 julia [Interactive Use (REPL = Read-Eval-Print)] 2018/10/25 01:51 julia [Using Different Julia Versions on the Same Computer] 2018/10/25 01:50 julia [Invokation] 2018/10/25 01:48 julia [Using Different Julia Versions on the Same Computer] 2018/10/25 01:44 julia [Windows] 2018/10/25 01:24 julia [Linux] 2018/10/25 01:23 julia [First Julia Installation] 2018/10/25 01:23 julia [Installation] 2018/10/25 01:21 julia [Installation] 2018/10/25 01:21 julia [First Julia Installation] 2018/10/25 01:20 julia [MacOS] 2018/10/16 04:21 julia Add missing quotes2018/10/16 04:20 julia Update paths2018/10/15 09:42 external edit2018/09/24 10:23 ivo [Linux] 2018/08/28 12:44 external edit Line 5: Line 5: juliarepl juliarepl - julia> pkgchk( [ "​julia"​ => v"1.0.1" ] ) + julia> pkgchk.( [ "​julia"​ => v"1.0.3" ] );   - # Installation + # Installation ​and Getting Started - WARNING ​Do not install versions ​prior to Julia 1.0. + WARNING ​Versions ​prior to Julia 1.0 are obsolete. ​ Do not install them. Download Julia for your computer from [julialang](https://​julialang.org/​downloads/​). Make sure to download a version that matches your operating system (Windows/​macOS/​Linux). Download Julia for your computer from [julialang](https://​julialang.org/​downloads/​). Make sure to download a version that matches your operating system (Windows/​macOS/​Linux). - ## First Julia Installation - FIXME (Andreas:) Mention ​Windows ​first. Our statistics show that the majority ​of users are on Windows. + ## Operating-Specific Julia Installation + + ### JuliaBox + + [Julia Computing](https://​juliacomputing.com/​) offers an ["​install-free"​ browser version](https://​juliabox),​ with optional customer support. ​ JuliaBox is nicely integrated for academic teaching purposes, too, and very reasonably affordable. + + + + ### Windows + + FIXME Do not trust my Windows description. ​ I am not a Windows user.  I need to run this by someone who knows this. + + Run the Julia installer from [julialang](https://​julialang.org/​downloads/​).  Julia usually installs into C:​\Users\YourUserName\AppData\Local\Julia-1.0.*. + + If you want to run julia from the command line (rather than through the Windows ​App), then set the variable JULIA_HOME to Julia'​s \bin directory, usually C:​\Users\YourUserName\AppData\Local\Julia-1.0.*\bin. ​ Setting environment variables is often easiest to do by typing env into the search start, and choosing Edit the system environment variables. + + If you want to run julia scripts from other directories,​ add %JULIA_HOME% to your %PATH%. + + text + c:/> set JULIA_HOME C:​\Users\YourUserName\AppData\Local\Julia-1.0.*\bin + + c:/> set PATH %JULIA_HOME%:​%PATH% + +  + + If you use setx instead ​of set, then this becomes stored in the registry. + + On Windows, ​users often start julia with a click on the julia app. ### MacOS ### MacOS - * On macos, install 'Apple XCode developer'​ from the appstore first (xcode-select install from the command line). ​ It will save you many headaches later on. FIXME (Andreas:) It shouldn'​t be needed for most users not that we have BinaryBuilder. It might still be useful to have but I wouldn'​t mention it as the first item. + * On macos, install 'Apple XCode developer'​ from the appstore first (xcode-select install from the command line). ​ It will save you many headaches later on. * Doubleclick (open) the julia*.dmg file, and drag the Julia application to (the usual program folder) /​Applications/​. * Doubleclick (open) the julia*.dmg file, and drag the Julia application to (the usual program folder) /​Applications/​. Line 35: Line 62:   + + On macos, users often start julia from the terminal (command line). ​ Julia is smart about figuring out where its packages are, provided the OS can find the executable (usually determined by the OS PATH). ​ That is, the only necessary user intervention is to tell the OS where to locate the binary. ​ (This is how all programs should be!)  For startup options, try $julia --help. ### Linux ### Linux - WARNING Do not obtain julia itself from the standard OEM [ubuntu/​debian/​redhat] repositories. ​ They are usually ​badly out of date. + WARNING Do not obtain julia itself from the standard OEM [ubuntu/​debian/​redhat] repositories. ​ They are often badly out of date. - FIXME (Andreas:) Again, a C compiler should no longer be necessary for most users + * On linux, start with by installing make and gcc. The compiler may not be necessary for many julia users, but the cost is small, and it reduces confusion later on. - * On linux, start with by installing make and gcc. + - On ubuntu, use apt install make gcc. - On ubuntu, use apt install make gcc. Line 55: Line 83: bash bash - bash> JV=1.0.1 + bash> JV=1.0.2 bash> cd ~/Downloads bash> cd ~/Downloads Line 64: Line 92: HTTP request sent, awaiting response... 200 OK HTTP request sent, awaiting response... 200 OK Length: 88405778 (84M) [application/​octet-stream] Length: 88405778 (84M) [application/​octet-stream] - Saving to: '​julia-1.0.1-linux-x86_64.tar.gz'​ + Saving to: '​julia-1.0.2-linux-x86_64.tar.gz'​ - julia-1.0.1-linux-x86_64.tar.gz ​ 100%[==========================================================>​] ​ 84.31M ​ 29.7MB/​s ​ in 2.8s + julia-1.0.2-linux-x86_64.tar.gz ​ 100%[==========================================================>​] ​ 84.31M ​ 29.7MB/​s ​ in 2.8s - 2018-10-08 18:15:22 (29.7 MB/s) - '​julia-1.0.1-linux-x86_64.tar.gz'​ saved [88405778/​88405778] + 2018-10-08 18:15:22 (29.7 MB/s) - '​julia-1.0.2-linux-x86_64.tar.gz'​ saved [88405778/​88405778] bash> tar xfz julia-$JV-*.tar.gz bash> tar xfz julia-$JV-*.tar.gz bash> ls julia-$JV bash> ls julia-$JV - julia-1.0.1 + julia-1.0.2 bash> sudo mv ~/​Downloads/​julia-* /​usr/​local/​src/​ bash> sudo mv ~/​Downloads/​julia-* /​usr/​local/​src/​ Line 86: Line 114:   + On linux, users often start julia from the terminal (command line). ​ Julia is smart about figuring out where its packages are, provided the OS can find the executable (usually determined by the OS PATH). ​ That is, the only necessary user intervention is to tell the OS where to locate the binary. ​ (This is how all programs should be!) For startup options, try $ julia --help. - ### Windows - Run the Julia installer from [julialang](https://julialang.org/downloads/​).  ​Julia usually installs into C:\Users\YourUserName\AppData\Local\Julia-1.0.1. + ### Jupyter Browser Frontend + + Jupyter is a beautiful notebook browser-based front-end for Julia, Python, and R.  Quantecon has an excellent ​[installation and getting started guide](https://lectures.quantecon.org/jl/getting_started.html).  ​Roughly, you need to do the following:​ + + 1. Install [Anaconda Python](https://​www.anaconda.com/​download/​). ​ Anaconda comes with Jupyter and other scientific tools. + + 2. In your operating system command line (shell), type julia. ​ in julia, when you see julia> , type Pkg.add("​IJulia"​);​ exit(0). + + 3. Open the newly installed Anaconda application. ​ (For example, in macos, open the application '​Anaconda-Navigator'​.) + + 4. There is a command line executable that allows you to invoke jupyter directly. ​ For example, on macos, it is ~/​anaconda3/​bin/​jupyter_mac.command. ​ You can navigate to your work directory and invoke it directly. + + + Many users like to use [Juno](http://​junolab.org/​),​ which is another modern IDE that can handle Julia with aplomb. + + + + + ## Starting Over from Scratch and Reinstallating Julia + + Julia libraries and other user files are typically stored in + + ^ **OS** ​ ^ **Binary Distribution** ​ ^ **User+Customization** ​ ^ + | Windows | %LOCALAPPDATA%\Julia-1.x,​y ​ | %USERPROFILE%\.julia | + | macOS   | /​Applications/​Julia-1.x/​ ​   | ~/.julia/ | + | Linux   | No default ​                   | ~/.julia/ | + + For JuliaPro (which often lags the standard Julia release): + + ^ **OS** ​ ^ **Binary Distribution** ​ ^ **User+Customization** ​ ^ + | Windows | %LOCALAPPDATA%\JuliaPro-1.x.y.z ​ | %LOCALAPPDATA%\JuliaPro-1.x.y.z\pkgs-1.x.y.z | + | macOS  | /​Applications/​JuliaPro-1.x,​y,​z.app/​ | /​Applications/​JuliaPro-1.x.y.z.app/​Contents/​Resources/​pkgs-1.x.y.z/​ | + | Linux  | No default ​ | JuliaPro-1.x.y.z/​JuliaPro/​pkgs-1.x.y.z/​ | + + Deleting these directories should completely start over. - FIXME (Andreas:) It isn't necessary to set JULIA_HOME so I'd just delete this. It might be useful to add the bin directory to PATH though. - Set the variable JULIA_Home to Julia'​s \bin directory, usually C:​\Users\YourUserName\AppData\Local\Julia-1.0.1\bin. ​ Setting environment variables is often easiest to do by typing env into the search start, and choosing Edit the system environment variables. - If you want to run julia scripts from other directories,​ add %JULIA_HOME% to your %PATH%. + ## Information about the Current Julia Installation (Version, Matrix Libs, etc.) - ### Learning Julia Install Contents (Version, Matrix Libs, etc.) + Start julia. ​ When you see the REPL prompt, you can type commands. julianoeval julianoeval julia> VERSION julia> VERSION - v"1.0.1" + v"1.0.3" julia> versioninfo() julia> versioninfo() - Julia Version 1.0.1 + Julia Version 1.0.2 Commit 0d713926f8 (2018-09-29 19:05 UTC) Commit 0d713926f8 (2018-09-29 19:05 UTC) Platform Info: Platform Info: Line 118: Line 178: BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=16) BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=16) LAPACK: libopenblas64_ LAPACK: libopenblas64_ + + julia> exit(0)   * see [Julia 1.0 Release Post](https://​discourse.julialang.org/​t/​julia-1-0-released/​13208/​21). * see [Julia 1.0 Release Post](https://​discourse.julialang.org/​t/​julia-1-0-released/​13208/​21). - Line 129: Line 190: ## Using Different Julia Versions on the Same Computer ## Using Different Julia Versions on the Same Computer - Julia versions keep all information in directories under ~/.julia/.  This means that it is possible to run multiple versions of Julia (e.g., ~/​.julia/​v0.6 and ~/​.julia/​v1.0) on the same computer without conflict.  JuliaPro uses an altogether different directory, too. + Julia versions keep all information in directories under ~/​.julia/​. ​ JuliaPro uses an altogether different directory, too. - + - FIXME (Andreas:) The package paths are no longer correct now that we use the new package manager. The v{x.y} directories were how the old package manager handled this. It is still not a problem to have several versions of Julia installed but the directory structure that handles this is now more complicated. This is because, with the new package manager, you'll often have several versions of a package installed for the same version of Julia. Which version to be loaded is determined by the manifest file. + - + - + - # Invokation + - + - FIXME (Andreas:) I'm not sure this is as common on Windows. Also, many users are using Juno so you might want to mention that. + - Julia is usually invoked from a command line.  Julia is smart about figuring out where its packages are, provided the OS can find the executable (usually determined by the OS PATH). ​ That is, the only necessary user intervention is to tell the OS where to locate the binary. ​ (This is how all programs should be!) - For startup options, try \$ julia --help. - ## Batch Use + ## Batch Invocation - To run your Julia program in batch, use the unix command line: + To run your Julia program in batch, use the unix terminal (or Windows cmd): sh sh Line 157: Line 209: ## Interactive Use (REPL = Read-Eval-Print) ## Interactive Use (REPL = Read-Eval-Print) - The REPL is a very convenient way to interact with Julia. ​ Just invoke julia without an argument. + The REPL is a convenient way to interact with Julia. ​ (It was already used above.) ​ Just invoke julia without an argument. To exit, you can run the exit() function (or C-D). To exit, you can run the exit() function (or C-D). + + * Emacs ESS understands .jl syntax. * JuliaPro also comes with an IDE named *Juno* based on the Atom editor. * JuliaPro also comes with an IDE named *Juno* based on the Atom editor. - * Emacs ESS understands .jl syntax. + * Jupyter is itself a complete environment. - ### 'Hello World!'​ in Technicolor + - FIXME (Andreas:) *Technicolor*?​ + ### 'Hello World!'​ in (Techni)color juliarepl juliarepl julia> printstyled("​Hello World!";​ bold= true, color=2) ##​ keyword arguments after ';'​ julia> printstyled("​Hello World!";​ bold= true, color=2) ##​ keyword arguments after ';'​ Line 177: Line 232: Hit to see possible completions. Hit to see possible completions. - ### UTF8 Conversion + + ### UTF-8 Conversion Type '​\sqrt'​ and hit to see conversion into the UTF character. ​ (This works for some other TeX math symbols, too.) Type '​\sqrt'​ and hit to see conversion into the UTF character. ​ (This works for some other TeX math symbols, too.) + ### Unix Shell Escape ### Unix Shell Escape When ; ls typed into the REPL, it runs the Unix shell command (ie., no need to exit to the shell). When ; ls typed into the REPL, it runs the Unix shell command (ie., no need to exit to the shell). + ### Help Shell ### Help Shell Line 211: Line 269: - ### Running a Julia file.jl ​Program from the REPL + ### Running a Julia source ​file.jl ​program in the REPL Line 220: Line 278: * if another.jl includes other.jl, julia includes other.jl from the directory in which another.jl lives. ​ So, an include("​../​another.jl"​) will look for other.jl in .. and not in . . * if another.jl includes other.jl, julia includes other.jl from the directory in which another.jl lives. ​ So, an include("​../​another.jl"​) will look for other.jl in .. and not in . . - Line 232: Line 289:   - * It is a buglet ​that no ';'​ should appear after the '##' ​(the comment), or it will print the random values, after all. FIXME (Andreas:) I don't understand this comment. + * There is a buglet ​in the 1.0.2 REPL parser. ​ julia> rand(10000);  # buglet;​buglet should be quiet, but the semicolon followed by text makes the REPL print the random values, after all. Line 238: Line 295: ### Reducing Long Vector Output on the REPL ### Reducing Long Vector Output on the REPL - FIXME (Andreas:) This section needs some context. I'm also not sure why you'd change ​the display ​size (I've never done that). + Sometimes, it is useful to tell the REPL to produce a lot or a little output. ​ Sometimes, this is best done by pretending to have a very long or very wide display (e.g., when you want to copy and paste REPL output elsewhere)---or ​the opposite. - + - To control printing defaults on the console: + juliarepl juliarepl Line 246: Line 301: julia> IOContext( stdout, :​displaysize => (25,80) ); julia> IOContext( stdout, :​displaysize => (25,80) ); +   - - - ## Not Yet Implemented - - ### Logging Input and Output of an Interactive Session - - Similar to R's sink(file=...,​ split=TRUE) is not yet possible. ​ The closest is the [logging function](https://​docs.julialang.org/​en/​stable/​stdlib/​io-network/#​General-I/​O-1). - - FIXME (Andreas:) Maybe redirect_stdout?​ - - ### Options - - Unlike R, Julia does not yet have good global options to control printing behavior. ​ For example, you cannot give control of the number of rows that long displays show in full.  For example, you cannot specify that you like 3 significant digits in numeric output. - - This is a planned feature for the future. Line 274: Line 315:   - * atreplinit() is called (only) before the REPL starts + * If an atreplinit() ​function has been defined, it is called (only) before the REPL starts.  This can be useful to customize the interface. + * Be careful: when you define functions in your startup, your Julia becomes different from the Julia that another user is running. ​ Ergo, this can occasionally lead to baffling errors when sharing code.  You can start julia with --startup-file=no to check if the Julia startup file is at fault. - FIXME (Andreas:) The atreplinit bullet needs some explanation to be useful. It might also be worth mentioning that adding too much to your startup.jl will make it harder to reproduce your results since a program file might not work for another user with a different startup.jl. - # Starting Over from Scratch - All standard Julia libraries ​and other user files are typically stored in + ## Terminal ​and Emacs Aspects - ^ **OS** ​ ^ **Binary Distribution** ​ ^ **User+Customization** ​ ^ + ### Terminal Support - | Windows | %LOCALAPPDATA%\Julia-1.x,​y ​ | %USERPROFILE%\.julia | + - | macOS   | /​Applications/​Julia-1.x/​ ​   | ~/.julia/ | + - | Linux   | No default ​                   | ~/.julia/ | + - + - For JuliaPro (which often lags the standard Julia release): + - + - ^ **OS** ​ ^ **Binary Distribution** ​ ^ **User+Customization** ​ ^ + - | Windows | %LOCALAPPDATA%\JuliaPro-1.x.y.z ​ | %LOCALAPPDATA%\JuliaPro-1.x.y.z\pkgs-1.x.y.z | + - | macOS  | /​Applications/​JuliaPro-1.x,​y,​z.app/​ | /​Applications/​JuliaPro-1.x.y.z.app/​Contents/​Resources/​pkgs-1.x.y.z/​ | + - | Linux  | No default ​ | JuliaPro-1.x.y.z/​JuliaPro/​pkgs-1.x.y.z/​ | + - + - Deleting these directories should completely start over. + - + - + - + - + - # Terminal and Emacs Aspects + - + - ## Terminal Support + Under macos, I recommend iTerm2 for a better terminal. ​ Under linux, the standard gnome terminal is good enough. Under macos, I recommend iTerm2 for a better terminal. ​ Under linux, the standard gnome terminal is good enough. Line 311: Line 332: - ## Emacs Support + ### Emacs Support Emacs is primarily supported through [ESS](https://​ess.r-project.org/​). ​ You may want to add Emacs is primarily supported through [ESS](https://​ess.r-project.org/​). ​ You may want to add Line 354: Line 375: * Similar to R's sink(file=...,​ split=TRUE) is not yet possible. * Similar to R's sink(file=...,​ split=TRUE) is not yet possible. - * I do not believe that Julia has default output ​options, e.g., allowing the output to preferentially default to x digits of significance. + * Julia 1.0.2 does not yet have a "default output" option, e.g., allowing the user to set output to preferentially default to x digits of significance. + + + ### Not-Yet Implemented + + #### Logging Input and Output of an Interactive Session + + Similar to R's sink(file=...,​ split=TRUE) is not yet possible. ​ The closest is the [logging function](https://​docs.julialang.org/​en/​stable/​stdlib/​io-network/#​General-I/​O-1). + + FIXME Investigate redirect_stdout --- I could not get this to work. + + + #### Options + + Unlike R, Julia does not yet have good global options to control printing behavior. ​ For example, you cannot give control of the number of rows that long displays show in full.  For example, you cannot specify that you like 3 significant digits in numeric output. + + This is a planned feature for the future. + ## References ## References