Dayalan Saravanan


Install Julia stable release v1.9.3 on Debian 12 GNU/Linux

Monday, September 18, 2023

It is strongly recommended that the official generic binairs from the downloads page be used to install Julia on Linux. Generic Linux binaries for x86 can be downloaded. This will get you a compressed tar.gz archive that will have a name similar to julia-1.9.3-linux-x86_64.tar.gz. The following set of commands downloads the current stable release of Julia into a directory named julia-1.9.3.

$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.3-linux-x86_64.tar.gz 
$ tar zxvf julia-1.9.3-linux-x86_64.tar.gz
$ mv julia-1.9.3/ .julia/

A directory with the extracted contents will be generated in the same directory as the compressed archive with a name similar to julia-1.9.3, where 1.9.3 is Julia's version number. This is the directory from which Julia will be run; no further installation is needed. To run it, navigate to the julia/bin/ directory and type: ./julia

To add Julia's bin folder (with full path) to PATH environment variable, you can edit the ~/.bashrc file.

export PATH="$PATH:/home/user/.julia/bin"

To activate the changes in the current shell, you have to source the updated ~/.bashrc file.

$ source ~/.bashrc

Now we can invoke Julia by just typing julia at the command prompt. We can do this now from any directory because the PATH has been updated to look for executable programs in our new directory.

$ julia --version 
julia version 1.9.3

Julia installs all its files in a single directory. Deleting the directory where Julia was installed is sufficient. If you would also like to remove your packages, remove ~/.julia. The startup file is at ~/.julia/config/startup.jl and the history at ~/.julia/logs/repl_history.jl

Resources for Julia programming:

Creating a virtual environment in Julia:

In Julia, VirtualEnv.jl provides support for creating environments with their own site directories, isolated from system site directories. Each virtual environment has its own Julia binary (which matches the version of the binary that was used to create this environment) and can have its own independent set of installed Julia packages in its site directories.

Installation:

$ julia 

julia> # press the key ] to enter package mode

(@v1.9) pkg> add VirtualEnv

(@v1.9) pkg> # hit backspace to exit package mode

julia> exit()

venv creates virtual Julia environments in one or more target directories.


    Usage:

      venv [options] [flags] <env_dirs>

    Args:

      <env_dirs>              one or more directories to create environments in

    Options:

      -p, --prompt <prompt>   provides an alternative prompt prefix for this environemtn. (Default: ENV_DIR)

    Flags:

      -c, --clear             delete the contents of the environment directory if it alreadyexists. (Default: false)

      -u, --upgrade           upgrade the environment directory to use this version of Julia. (Default: false)

      -h, --help              print this help message

      -v, --version           print version information
    

Print help dialogue:

$ venv -h

Creating a virtual environment:

$ venv ~/dsci

Activating the virtual environment:

$ source ~/dsci/bin/activate

Deactivating an environment:

$ deactivate