Install Julia Packages


This page describes how to install a Julia package as a user in a CoCalc project. If you are using Compute Servers, there is no need to do anything CoCalc-specific, just follow standard instructions.


You should consider using Compute Servers for research or production work with Julia, since it quickly becomes resource-intensive. Here CoCalc’s CEO and Founder William Stein explains how to use Julia on compute servers:

Install Requests

CoCalc already includes hundreds of Julia packages. If a package may have general use but is not already installed in CoCalc, please open a support request to tell us to install it globally for everyone. Please include information about special dependencies or a specific example to test it. Please be aware, due to upgrade issues or general conflicts, not all packages can be installed.

Install/Update a Package Yourself


Your project must have the “Internet access” upgrade in order to download software from a remote repository (i.e. the General Julia package registry to your project. The install command will not work unless you upgrade your project to have internet access.

Command Line / Custom Depot Path

To install custom Julia packages as a normal user, you have to type this in a terminal before starting Julia:

export JULIA_DEPOT_PATH=$HOME/julia_depot

When you do this, you will have to reinstall any needed Julia packages that were installed system-wide, since that’s the way Julia works.

To have this setting picked up by any terminal in a given project, you can set the JULIA_DEPOT_PATH environment variable as explained in Custom environment variables and restart the project.

After setting JULIA_DEPOT_PATH, follow the usual Julia pkg documentation:

  1. Create or open an existing Linux Terminal file.

  2. Type ] (right bracket). You don’t have to hit Return.

  3. Type type add <package_name> to add a package; you can provide the names of several packages separated by spaces.

  4. Allow some time for the package to be compiled.

  5. Hit backspace or Control-C to exit the package manager and Control-D to exit Julia.

Command Line / Custom Environment

Julia comes with a packaging mechanism to create custom environments. This might be what you really need in order to make your code work in many places.

Note: details about how to set this up and how it works is beyond CoCalc’s expertise.

To use such an environment in a Jupyter Notebook, you will have to setup your own kernel in a CoCalc project. Follow Custom Jupyter Kernel for how to do this – you basically copy one of the global Julia kernels and tweak it’s kernel.json definition.

In a Jupyter Notebook

No special environment setting is needed. Simply do the following in a code cell in a Jupyter notebook that has the default Julia kernel selected:

import Pkg; Pkg.add("package_name")

and let the install run to completion.

This will cause Julia to install that package locally on top of the globally installed packages. That might not always work, though. You might also want to try installing from the command-line, to get a better view into the console output and to better understand any error messages.