I'm working with julia now, but some old version of code is deployed on julia 1.4.2, now I want to recheck the code but I don't want to switch between julia 1.6.3 (often used version) and 1.4.2. So I want to create a virtual env with conda, but now it seems that julia 1.4.2 is not available with conda. Any suggestions?
-
1You can easily have multiple versions of julia alongside and, at least in Linux, you can just symlink them, let's say, to julia1_4 or julia1_6. That's says, except very specific packages that use some julia internals, everything that works on julia 1.4.2 should also run on julia 1.6.3, so no need to use the old version..– AntonelloOct 23, 2021 at 8:04
-
Thanks, but actually I tried to stick to julia 1.6 at first, something still went wrong no matter how I changed version of dep packages.– BetristorOct 23, 2021 at 9:02
1 Answer
If you want to run more than one Julia version at a time you basically need to make sure that they use different location for package repositories (called depot path.
By default the folder used for depot path is ~/.julia
(or %HOMEPATH%\.julia
on Windows). If you start installing multiple Julia version you have a good chance to end up with a corrupted package repository.
Hence what you need is to set up the JULIA_DEPOT_PATH
system variable - differently for each Julia version (see https://docs.julialang.org/en/v1/manual/environment-variables/).
For an example on my machine I have Julia 1.6.3 and Julia1.7.0rc2 and before starting either of them I run (Windows syntax this time):
set JULIA_DEPOT_PATH=c:\JuliaPkg\Julia1.6.3
or on Linux:
export JULIA_DEPOT_PATH=/home/ubuntu/Julia1.6.3/
This allows me to keep my package configurations separate.
-
I don't believe at all this is needed. Julia default environments are already by julia version, e.g.
v1.5
, so they do not conflict if multiple versions use the same depoth path. I have successfully used different versions by just symlinking the executables for years now.. Oct 23, 2021 at 18:39 -
The folders
JULIA_DEPOT_PATH\environments
have indeed folders with versions. HoweverJULIA_DEPOT_PATH
contains much more than that and other file names would simply overlap - make 2 Julia installations with differentJULIA_DEPOT_PATH
S and check yourself!. When they overlap they might work or not - but for sure that is not a good design to have one Julia package installation to randomly overwrite files of the another installation. Oct 23, 2021 at 21:11 -
I did corrupt my registry once which bothered me a while. I tried firstly manually create v1.4 folder under .julia/environment and started julia 1.4.2 cause julia 1.4.2 itself didn't do this for me. Nothing went bad except switching environment in vscode is a little troublesome. Thanks for advise @Przemyslaw Szufel, I'll try this after. Oct 24, 2021 at 7:01
-
The point is that there are several other folders in .julia - e,g, including
.julia/conda
being several GBs in size. And the file names for those folders simply overlap. You can still be "lucky" and have everything to work. However, I personally do not like for my software configs to depend on "being lucky". Oct 24, 2021 at 10:55 -
2There is no need to have unique depot paths for different julia versions. The system is setup so that this is not needed and doing so will lead to a worse experience where you download multiple identical packages and artifacts multiple time. If there is an issue with this, it is a bug and should be reported to the issue tracker. Oct 25, 2021 at 7:33