Thsi question is relevant to the current package manager. It there is an answer for Pkg3 this will be welcome also. The Documentation does have a section on removing packages. but it is unclear and has not worked for me in the past. Should I use Pkg.free(“packagename”) ??
I have three use cases at the momen tfor removing packages:
- I might give a talk to colleagues. I might want to demonstrate how to install IJulia
- I wish to develop in the ClusterManagers package - so need to remove the existing copy and substitute with the development version
- sometimes I am convinced that a package is completely fuled up and I want to start from a clean install
I do admit that the third use case is stupid, but I have got into messes in the past with ImageView on Windows 10 and I ended up wiping Julia and starting from scratch.
Pkg.rm is the way on Pkg2.
It is similarly used in Pkg3 except it won’t actually delete the package, it will just remove it from the project. In Pkg3 you can have multiple versions of the same package installed at the same time and different projects can use different versions.
If you want to show julia from scratch with Pkg2 you can set the
JULIA_PKGDIR env variable to some folder and do
Pkg3 you can use the
pkg> gc command to delete all package versions that are no longer referred to by any projects (those found in
~/.julia/logs/manifest_usage.toml). For example, I just did this on my system:
[ Info: Deleted 93 package installations saving 395.409 MiB
I suspect most people won’t have quite so many random package versions installed since I do a fair bit of messing around with installing and changing packages. The
pkg> gc command isn’t yet called automatically, but we intend to set that up at some point in the future. It will also clean up old resources like obsolete
rm package only removed the package in
packages folder. It can not remove package in the
dev folder. How can I do it?
I think you mean
rm -rf ~/.julia/dev/PackageName
Your version would be quite catastrophic if someone had a
dev folder in their home directory!
That’s where I keep my dev packages. Don’t run random code some guy posts on the Internet without making sure it doesn’t do something bad
you can have a (default) dev path that is different (not under) the
Or you just manually do
dev /path/to/my/dev for every package you dev?
after removing the package, I get some errors:
ERROR: path /usr/people/jingpeng/.julia/dev/Clustering for package Clustering no longer exists. Remove
the package or `develop` it at a new path
I have to run
rm package to really remove it in Project.toml file.
Correct. I assumed you’d already done that since a package wouldn’t be gc’d unless it was removed from all projects already.