When I first started Julia I installed a Lot of packages to try. Now I have two pagefulls with conflicts and it’s hard to figure out which pkg is the cause. I’d like to just delete the lot and reinstall the few I’ve found useful for now. Is there a way to do that?
~/.julia/environments/v1.x, x can be 6 or 7 depending on what you have. Note this won’t delete the packages’ source code, just the Manifest.toml that records your environment, so when you re install some packages, you won’t have to re download them all
Also, this is a good occasion to learn to use local environments, instead of polluting the global one, which should really be as small as possible
BTW, a relatively unknown trick is to do
to create a temporary one-off environment that will be automatically deleted at the end of the Julia session. It’s very useful to quickly try out some packages
~/.julia/environments/v1.x , x
Doing this can break your startup.jl file, so you might want to rename it before you do this. Otherwise Julia will fail to start the REPL and you’ll have to deal with startup.jl anyhow.
My startup.jl file has lots of things like
using Revise in it, for example.
The recommended configuration for Revise suggests putting
using Revise in a
catch block. Not relying on the global environment having third-party packages installed is good.
you can always get around the first time by
since we’re talking about deleting and reinstalling… this shouldn’t be too much on top of the hassle
Correct me if I’m wrong. But one thing I find annoying about local environments is that adding a package in the environment may cause it to be updated. Sometimes this triggers precompilation of many packages. It is not the same as just use a package that is already there.
As far as I know, local and global environments are no different in this regard: by default adding a package triggers an update (maybe only the first time in a session) and precompilation of all packages in the environment (that’d be way less than having everything in a single global environment).
If you’re annoyed by precompilation, there is a trick to not update packages on
add, it has been shared a few times here on discourse, many people put that code in their startup file
I have never regretted deleting my
.julia folder entirely and reinstalling everything from scratch. It is shockingly fast these days.
But as I think other people have said, if your global environment is getting mucked up, then it is almost certainly because you aren’t using project/manifest files sufficiently. The only things I have in my global environment is IJulia, Revise, and BenchmarkTools and the occasional others.
Yes, you’re right. It is not that exactly. The annoying thing is that a package that is installed in a local environment is not available to
using in the other environments (as are the packages installed in the “main” environment). Thus, either one has to install things on the “main” environment, or keep adding packages to new environments every time.
I was talking about not updating, not not precompiling:
But I guess someone may not want to precompile (?)
I deleted the whole
.julia folder with almost 20 GB, as suggested above, but after restarting Julia, the whole shebang is reinstalled again (200+ packages).
How to start from scratch?
Thanks in advance.
On Win11, with juliaup installed and using VS Code.
This is odd.
Despite that deleting complete
.julia is NOT recommended anymore, because you delete
dev’ed packages too for example and may loose some work, julia should start clean and plain after deleting (or better renaming) .julia anyways.
I just tried renaming .julia (Windows 10) and it just created it newly with only about 500MB and no packages reinstalled. There seems to be something special on your side. Any environment variables set? Like one or several of Environment Variables · The Julia Language ?
Thanks for your response.
Did another test, deleting again the new
.julia folder (btw, I had made a backup of startup.jl beforehand) and typing in the Pkg REPL the following command:
] rm --all
… this removed all packages from default working enviroment but the list of 200+ packages were “restored” once again in
However, their size on disk was dramatically reduced. Not clear for me what is going on here.
My guess is you have something special in