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.
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.
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.
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?
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.
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:
Install desired packages onto a computer with internet access.
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.