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.


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.


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.


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.