Delivering Julia code to production computers


#1

In our MATLAB production projects, we can deliver (copy) our compiled MATLAB code with the corresponding MATLAB MCR to production computers without installing MATLAB MCR on them. This makes it easy to switch between different versions of MATLAB. Is this possibility planned for Julia (without installing Julia on production computers)? This is a very important feature for large projects.


#2

VLadimir, there is the possibility of compiling Julia. Other people will comment on this as they know better than me.
I work in HPC. There was a thread recently on using Julia with a shared filesystem – how to cope with the initial JIT compilations being triggered on multiple hosts.


#3

The question was how to copy Julia code together with the Julia run-time onto the target production computer without installing Julia on it, which is not always possible for many reasons. This feature exists in MATLAB and is not associated with shared folders. This is a very important feature for the use of Julia in the production.


#4

This company has a commercial option: http://www.techilatechnologies.com/distributed-julia-juliacon/

Or if not exactly fitting to your needs they are probably willing to develop it.


#5

If julia’s dependencies are installed in the host machine (i.e. libuv, libgit2 and possibly a few other), the precompiled binaries (the ones here) can just be extracted in some folder and that’s pretty much it. Works out of the box.


#6

I think the key question is what you mean with “installing Julia” and what aspects make this difficult on the target system.

For Matlab I understand that an installation can be difficult because it may require

  • files in a system directory
  • inclusion in PATH and/or other environment/registry variables
  • a licensing solution

whereas an MCR solution sidesteps all of these by bundling a subset of the Matlab system (i.e. the runtime) with your application.

Neither of the points above apply to Julia and you can just bundle the entire Julia like you would do with the MCR part of Matlab. There might be a question of how large the things you need to bundle are, but if you see other difficulties, please be more specific about what those are.


#7

How I can bundle the entire Julia installed on one Windows computer and copy it to another, different computer (with different user name, etc.) where Julia is not installed?
Can Julia with all its installed packages can be copied into a selected target directory on a computer without Julia as the MATLAB MCR ?


#8

Short answer, yes. Copying the .julia folder (that contains installations of packages) and julia binaries should work or at least be require minimal additional work (fixing paths etc.)


#9

If you commit the Manifest.toml in a git repository, it will reproduce the same package versions.

Alternatively, a Docker image or a similar container can easily be created, updated, distributed, and reproduces the exact same environment.


#10

" Short answer, yes. Copying the .julia folder (that contains installations of packages) and julia binaries should work or at least be require minimal additional work (fixing paths etc.)"

I actually need a long answer, how to merge “.julia” folder and julia binaries folder into one arbitrary folder on a target Windows computer without Julia :slight_smile:


#11

If you are copying these folders anyway and running binaries anyway why not just copy the julia folder and run julia?

There is no “installing” julia. Copy the folder across and it will work. (as long as you have the necessary libraries installed)

Edit: Sorry I didn’t quite understand what you didn’t understand: the main question here is how to set the .julia folder to an arbitrary path? (You can put the julia folder anywhere).

You should find what you need here:
https://docs.julialang.org/en/v1/manual/environment-variables/index.html


#12

I have done exactly this in the past, with Julia 0.5, creating an installer with Inno Setup that bundled Julia together with our application and could be installed and run on a computer that didn’t otherwise have Julia. Things may be a little different with Julia 1.0 but I assure you it can be done.

The base Julia is the least problem. Just take the Windows binaries and place them somewhere in your application directory.

User packages allow some options, depending on what you can do at install time. The easiest is if you can run package installation as post-install step. Point DEPOT_PATH to somewhere in your application directory and use Pkg.instantiate to replicate the packages from a manifest. If this is not an option you basically want to do the same thing in your build environment before packing up the installation. What can cause problems, or at least did in Julia 0.5 times, is if you have packages with binary dependencies with build scripts that set up absolute paths to the dll they depend on. I had to patch up a few such paths to make them relative instead. This may or may not still be a problem. If it is, a potential solution is if you can run their build scripts at post install time. I haven’t explored this with Julia 1.0 since the instantiation from manifest at end of install works fine in my setting.


#13

Thanks for very detailed reply!


#14

Another option is to use Docker to pull proper OS and Julia binary images. Combine that with Project/Manifest.toml to ensure proper dependencies. This is super consistent and can run everywhere.


#15

It’s not so popular in Windows world…


#16

Popularity is not a reason to dismiss a reasonably well-established approach to bundling applications, their dependencies, and associated configurations. Docker works decently well in Windows via Docker-machine from what I hear.

You could also put your application in a VM and ship that; there’s plenty of precedent out there, even though it’s not the most efficient approach.

To expand on @tk3369 's suggested approach, there was some discussion about a related question here (permalinking my response because I consider it a solution to this problem as well):


#17

Unrelated: Do you have a link to that? I work with HPC also. For every package I run @everywhere I first using Pkg locally on the head node. This triggers the precompilation, where the compiled files are instantly copied over to the compute nodes by InfiniBand.


#18

Hello. Sorry - I did search and I cannot find that thread.
Your technique sounds good, and I think it was similar to what was said in that thread.