Portable Julia

I noticed that a portable Julia is now available for the Windows platform.
I think this might lead to a Julia-on-a-stick, but a little bit more work is required, I think.

I started putting together a bash script for this purpose. Any interest?

4 Likes

Sorry for the ignorance but what a portable Julia consists of?

In my conception it would consist of the (i) Julia installation folder and the (ii) depot folder. Plus (iii) anything else I may wish to throw in (perhaps packages I work on, or packages I wish my students to have preinstalled).

This is what it looks like at the moment (while I am working on it, so not a finished product yet):
image

My point is that when you grab a zipped archive of the portable Julia and unzip anywhere, you will use precisely what I set up for you to use. No need to wait till the registry is queried, all the packages are downloaded from the registry and installed or installed and built. This takes a longish time on Windows systems (courtesy of the antivirus program).

3 Likes

See Julia Portable Mode o Standalone

3 Likes

In case this applies to your situation: I use the git bash. Here is my bash script to set up the portable Julia:

#
set -o errexit 
set -o nounset

# Make sure we are in the folder in which the portable Julia is installed.
MyPortableJulia=julia-1.5.0
if [ ! -d $(pwd)/$MyPortableJulia ] ; then
    echo "Need to be in the folder with the portable Julia, $MyPortableJulia"
    exit 1
fi

# Locate the Julia depot in the current folder.
export MyDepot=$(pwd)/.$MyPortableJulia-depot
if [ ! -d $MyDepot ] ; then
    mkdir $MyDepot
fi
export JULIA_DEPOT_PATH=$MyDepot

# Make sure we can start Julia just by referring to the program name.
export PATH=$(pwd)/$MyPortableJulia/bin:$PATH

# Bring up the Julia prompt.
echo JULIA_DEPOT_PATH=$MyDepot
julia

A newer version, which starts VS code, looks like this:

#
set -o errexit 
set -o nounset

# Make sure we are in the folder in which the portable Julia is installed.
MyPortableJulia=julia-1.5.0
if [ ! -d $(pwd)/$MyPortableJulia ] ; then
    echo "Need to be in the folder with the portable Julia, $MyPortableJulia"
    exit 1
fi

# Locate the Julia depot in the current folder.
export MyDepot=$(pwd)/.$MyPortableJulia-depot
if [ ! -d $MyDepot ] ; then
    mkdir $MyDepot
fi
export JULIA_DEPOT_PATH=$MyDepot

# Make sure we can start Julia just by referring to the program name.
export PATH=$(pwd)/$MyPortableJulia/bin:$PATH

VSCode-win32-x64-1.48.1/Code

This file can be executed in Windows 10 just by double-clicking it.

2 Likes

A Windows batch file. This one starts (a portable) VS code executable
after setting the depot path.

@echo off
rem This needs to be changed if you switch versions of Julia
set MyPortableJulia=julia-1.5.0
rem Grab the folder where the portable Julia installation lives
set MyPortableJuliaDir=%~d0%~p0
rem Set Julia depot: all package data goes in here
set MyDepot="%MyPortableJuliaDir%.%MyPortableJulia%-depot"
set JULIA_DEPOT_PATH=%MyDepot%
rem Start VS Code to play with Julia
"%MyPortableJuliaDir%VSCode-win32-x64-1.48.1/Code.exe"
1 Like

Sorry, the Windows batch file doesn’t work at the moment: VS code error

Edit: I abandoned the batch file. I can get the job done with a bash script: much nicer to program. And it can be operated with the same double-click as a batch.

I will teach a course soon where the students will be provided with examples in the Julia programming language. In order to facilitate the procedure I will supply them with a bundle (zip file) that needs to be expanded (anywhere), and a script that the students double-click to install Julia, required packages, and a portable, preconfigured VSCode that pops up at the end of the installation. For anyone interested: http://hogwarts.ucsd.edu/~pkrysl/shared/Portable_Julia.zip

The installation is totally local to the expanded folder (it will not clobber any pre-existing Julia installation or depot), which can be anywhere, even on a USB stick. Hence portable Julia environment.

13 Likes

An update has been posted: http://hogwarts.ucsd.edu/~pkrysl/shared/Portable_Julia-1.6.zip

Julia 1.6 release candidate 1 is used. The newest VS code. The user’s system does not need to have Git installed: the portable version of it is included. All the user needs to do is to double-click a batch file: everything installs itself, and VS code pops up preconfigured for work with Julia. Thanks to Julia 1.6 the installation is much quicker than it used to be: 4 minutes flat till the editor comes up on my slowish laptop with Wi-Fi connection.

Works on Windows10 systems.

7 Likes

Thanks to @musm for making the Windows portable installer!

-viral

1 Like

Indeed! Thanks, @musm.

One more update: users not raised on *nix systems sometimes insist on having spaces in their usernames, despite advice to the contrary. My script was broken as it did not handle that case properly. I updated the script so that user names with spaces in them do not cause any trouble.

5 Likes

This is cool, I have done something similar, we should compare notes at some point:

2 Likes