How to deinstall a package


#1

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.


#2

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 Pkg.init().


#3

Also, in 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:

pkg> gc
[ 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 .ji files.