I am using julia1.5.2 (on a linux machine) and noticed
that it creates a directory .julia under my home directory
and installs downloaded packages there.
I have installed julia1.6.7 in a different directory to
julia1.5.2
I want to use julia1.6.7 but suspect that it will install
downloaded packages in the above-mentioned .julia
directory thus overwriting the existing files there.
I would be grateful if you could provide some steps
on how to direct julia1.6.7 to use a different directory
for installing packages, for example, .julia1.6.7
Multiple Julia versions are designed to be able to cooperate in the same depot (.julia) but if you absolutely don’t want them to, you can set the environment variable JULIA_DEPOT_PATH to point elsewhere.
They will both write into .julia but they will write into separate parts. For example, I have
ls ~/.julia/environments/
v1.10/ v1.11/ v1.6/ v1.7/ v1.8/ v1.9/
Also, any specific reason you’re still using 1.5.2? That’s a pretty out of date version (so is 1.6.7, but that is an LTS which makes it a little more understandable).
No problem at all to install any number of Julia versions in parallel. I have a run_julia script per project, and use
´´´
jill switch 1.9
julia --project
´´´
or whatever version is needed for the current project to activate the correct julia version. You can achieve the same result with juliaup, just the command is different.
There are valid reasons to use separate depots although I suspect that it’s overly conservative in this case. I use two depots myself to handle two completely separate environments with different private registries and different package servers.
Honestly think twice before doing this - messing with the load path is more of an advanced use case. Fwiw I’ve been using Julia since 0.3 and have every version from 0.6 to 1.10beta2 installed on my current machine, all with a single .julia directory and without any load path shenanigans.