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?

5 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.

15 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

Hi,

I am exited. Are there plans to provide it in a form that is easy to getting updated,
once a new Julia-Version is out?

Regards,

Stefan

Hi Stefan, I have plans to integrate Juliaup (GitHub - JuliaLang/juliaup: Julia installer and version multiplexer) into this distribution in order to update Julia from the command line. Juliaup in itself is a really cool project and might fill some of the gaps that Juliawin set out to fill (like easily having separate Julia versions on the same machine). Juliaup isn’t portable though in the same way as Juliawin, but Juliaup does make it easy to replicate an environment elsewhere, which might be better for most modern use cases. As you can tell I’m a big fan of Juliaup

Portable Julia update: bundled with Julia 1.7.1, newest VSCode (1.63.2).
Portable_Julia-1.7.zip

Edit: With VSCode 1.64.2 and Julia 1.7.2.
Portable_Julia-1.7.2.zip

6 Likes

There is now a superior Julia-cum-VSCode on a stick (i.e. portable): GitHub - PetrKryslUCSD/VSCode_Julia_portable: Portable Julia running in VSCode
The download is all of 4KB. Double click a batch file, and a few minutes later you have an open editor + Julia up and running. (Windows 7 and up.)

2 Likes

But that requires an internet connection, correct? Can you think of a way to put everything on USB stick so that the person using it does NOT need an internet connection?

As you suggested, create the usb stick on a system that does have internet connection, but then you can use anywhere.

1 Like

Different topic: I cannot really use your version yet for two reasons:

  1. In my tutorial (KiteSimulators.jl/PackageInstallation.md at main · aenarete/KiteSimulators.jl · GitHub) I assume access to a windows terminal that has julia in the search path. I could not find that in your project.
  2. You install vscode in such a way that it starts with your tutorial. No offence, but I would prefer my tutorial or no tutorial at all.

Do you see a way to address these issues?