Is there a way to get the names and version numbers of the currently loaded modules in a Julia session?
You can get the modules with
Base.loaded_modules. Julia itself doesn’t have a concept of versions on modules so that doesn’t exist.
Thank you a lot!
@kristoffer.carlsson Is it “save” to use
Base.loaded_modules with respect to future
Julia 1.x releases? From the answer to this question Using an already-loaded module in 0.7 - #6 by StefanKarpinski I assumed I should avoid using it.
@dmolina you are right, I was talking about packages. This package helps already a lot. I want to figure out what pacakges (and versions) are loaded in a custom system image. At leaste, for my own packages I am able to do that now, thanks.
It depends what you mean with safe. It is an internal variable so it is possible it could change in the future, yes. There isn’t really any other way to do it right now though.
Here’s a one-liner for finding the version number of a loaded module, e.g.
using Pkg using HTTP Pkg.dependencies(x -> x.version, findfirst(p -> p == HTTP, Base.loaded_modules).uuid)