4

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?

Betristor
  • 51
  • 3
  • 1
    You 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.. – Antonello Oct 23 '21 at 08: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. – Betristor Oct 23 '21 at 09:02

1 Answers1

0

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.

Przemyslaw Szufel
  • 40,002
  • 3
  • 32
  • 62
  • 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.. – Antonello Oct 23 '21 at 18:39
  • The folders `JULIA_DEPOT_PATH\environments` have indeed folders with versions. However `JULIA_DEPOT_PATH` contains much more than that and other file names would simply overlap - make 2 Julia installations with different `JULIA_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. – Przemyslaw Szufel Oct 23 '21 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. – Betristor Oct 24 '21 at 07: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". – Przemyslaw Szufel Oct 24 '21 at 10:55
  • 2
    There 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. – Kristoffer Carlsson Oct 25 '21 at 07:33
  • @KristofferCarlsson I learned to used separate `JULIA_DEPOT_PATH` after my package repo crashed several times when sharing the same depot between Julia instances. This was though in much earlier Julia versions - I am glad to hear that this has been repaired in meantime. At that time every single time I had to delete the depot (aka .julia folder) and reinstall all packages from scratch. – Przemyslaw Szufel Oct 25 '21 at 10:49