How to ship the exact environment together with a julia script

Yes, this is the way to do it. You need to be observant that you don’t depend on anything in your global environment though, preferably by removing it from your load path.

No, it will only update versions of dependencies if you run Pkg.update, so don’t do that. You may need to Pkg.instantiate() though to make all the packages available in the right versions and it’s a good idea to start your script with that.

Yes, this is a known weakness. If you can instantiate on a newer version of Julia with the same major version you should be good to go but otherwise you need to run an older version of Julia. It’s a good idea to document which version of Julia was used originally.
Edit: This doesn’t sound right. Updating to a higher minor version should be fine but going to an older version can certainly be problematic, so it’s at least a good idea to document the used version for that reason.

1 Like