Julia 0.7
This article is installing Julia 0.7 and providing it as a reusable environment. If you just want to use Julia 0.7 in your own articles, see the Reusing section below. Futher down you will see how it was built.
Reusing the Environment
Short Version: Follow mk/julia-0.7-template and click Remix.
Long Version: To learn to how reuse environments accross articles, follow these steps:
- Create a new article
- Insert a Julia Cell
- Activate the runtime settings in the runtime panel on the far right
- Bring up the environments dropdown
- Select the Transclude environment… option
- Search for this article
mk/julia-0.7
by entering julia into the search field - Select this article and the Julia 0.7 environment in it
Building the Environment
We base this off our Minimal Bash image. Notice how the JULIA_VERSION
environment variable is set on the runtime.
PATH | /usr/local/julia/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
JULIA_PATH | /usr/local/julia |
JULIA_GPG | 3673DF529D9049477F76B37566E3C7DC03D6E495 |
JULIA_VERSION | 0.7.0 |
The exact version we're installing is 0.7.0
.
echo ${JULIA_VERSION}
Here, we download the archive using curl.
tarArch='x86_64' dirArch='x64' JULIA_VERSION_SHORT=${JULIA_VERSION/-rc/} echo "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION_SHORT%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc" curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION_SHORT%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc" curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION_SHORT%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"
Next, the signature is checked using gpg. This ensures we've downloaded the correct image.
sha256="35211bb89b060bfffe81e590b8aeb8103f059815953337453f632db9d96c1bd6" echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ savedAptMark="$(apt-mark showmanual)"; \ if ! command -v gpg > /dev/null; then \ apt-get update; \ apt-get install -y --no-install-recommends gnupg dirmngr; \ rm -rf /var/lib/apt/lists/*; fi; export GNUPGHOME="$(mktemp -d)"; gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$JULIA_GPG"; gpg --batch --verify julia.tar.gz.asc julia.tar.gz; command -v gpgconf > /dev/null && gpgconf --kill all; rm -rf "$GNUPGHOME" julia.tar.gz.asc; apt-mark auto '.*' > /dev/null [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
PATH=$JULIA_PATH/bin:$PATH mkdir "$JULIA_PATH"; tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1; rm julia.tar.gz;
Lastly, we check that we can run Julia.
julia -v
julia -e 'using Pkg Pkg.update() Pkg.add("JSON")'
julia -e 'using JSON'
Testing it
Lastly, let's create a Julia code cell that uses our newly built Julia image.
Base.VERSION
And it works 🎉