Cleaning up old versions

I’m kind of new to Julia and just updated to version 1.5
I noticed that my packages need to be reinstalled (eg ] add Plots).
If I go to ~/.julia, there is almost 2GBs of data, mainly in ~/.julia/conda and ~/.julia/packages. If I would want to start from a clean slate with version 1.5, how do I do that properly?

Should I just remove the complete ~/.julia folder and reinstall? Or is there a more sophisticated way of removing older versions?

1 Like

You can just remove .julia from your user directory and start Julia REPL again. It’ll start “from the clean state”.

If you want to get all your packages in v1.5, first copy .julia/environments/<oldversion> to .julia/environments/v1.5.

1 Like

Thanks. So, more general: if I remove .julia and put back a version of a Manifest.toml and Project.toml (could be that of v1.4, but maybe also a backup of my current v1.5, or even another project), all those packages listed there will be reinstalled?

Normally it is sufficient (and safer, with less risk of version conflicts) if you only copy the Project.toml file and run ]instantiate. That way you let the package manager guess what are the suitable versions of the added packages that have not been pinned, and of the indirect dependencies.

If you also keep the Manifest.toml file, you are telling the package manager to use exactly the same versions of all (direct and indirect) dependencies. This is recommended for reproducibility, but if you are already changing the Julia versions, you may encounter changes anyway, and the exact set of package versions used in 1.4 may work, or may not work.

5 Likes