Copying packages to ~/.julia, but they aren't found

I do a lot of work on an offline machine, and I’m trying to set up Julia on it. I already have Julia installed and working on that offline machine.

As a first attempt at bringing in packages, I’ve copied and pasted all the packges in my ~/.julia/packages folder, from my online machine (macOS) to my offline machine (linux).

When attempting to use those packages, e.g. using DifferentialEquations I get that they aren’t found.

Am I going about this completely the wrong way?

The new package manager uses a manifest file to manage all packages. You could manually edit the .julia/environments/v1.0/Manifest.toml and register them that way (then copy it into dev instead of packages. Or you could use the generate command to automatically handle the creation of a new package, and then paste your files into the dev directory. There’s probably some other ways you can go about it too, but someone who is more knowledgable about the new package manager would have to explain.

If you already have the global manifest file from another installation of Julia, copy it along with the packages directory.

Don’t do this.

Kinda. What is inside ~/.julia/packages is not the same as what is installed and putting something there does not make it available to using. What is available to using is governed by the Project.toml file. The default one is located under ~/.julia/environments/v1.0/Project.toml and is accompanied with ~/.julia/environments/v1.0/Manifest.toml. You can try to copy your ~/.julia/packages folder together with the Project.toml and Manifest.toml files to the other computer. In theory this should work for pure Julia packages. It will fail for packages with binary dependencies though, since you copy between two OS.

1 Like

The global Manifest and Project files are simple enough that you can hack them manually, if you have the spirit of adventure.

For example, if you are only copying a subset of packages over, you can splice the portions of the Manifest specific to those packages.

Theoretically, you could write an import/export tool that automatically picks out the relevant sections of the global manifest for a list of pkg.

I think the point is just that there is a cleaner way to get the job done.

1 Like

If it turns out I need some of these packages, could I theoretically use an online Linux machine to download the desired packages, and then copy to the offline Linux machine?

Would the two versions of Linux need to be exactly the same?

Try it! I don’t know, will probably be different depending on the package and its dependencies.

1 Like

If that is a concern (I don’t know), you can always use something like a Docker image to replicate the exact same environment. Or even have a Dockerfile download and install everything, then just copy the resulting image to the machine w/o net access.

The OS would not have to be exactly the same, but you would need to have the appropriate version of dependencies for BLAS, etc.

If you want to copy packages from a machine with internet access to an offline machine (without internet access), you need to copy the entire .julia directory (and not just the ~/.julia/packages folder).

A method that has worked for me:

To get Julia working on a computer without internet access:

  1. Install desired packages onto a computer with internet access.
  2. Copy entire .julia directory and transfer onto the computer without internet access.

I have tested this for the online and offline machine running Windows10. I assume you could do the same with other operating systems as long as the operating system on both computers is the same.