Reputation: 1681
How do I find out my package version in Julia? Is there a command which shows the version that's being used?
Upvotes: 5
Views: 830
Reputation: 69879
It is easy to check the version that is installed in the current project environment:
(@v1.5) pkg> st DataFrames
Status `D:\.julia\environments\v1.5\Project.toml`
[a93c6f00] DataFrames v0.22.1 `D:\.julia\dev\DataFrames`
It is more difficult to get a version of currently loaded package (that might be different if you e.g. changed project environment or upgraded the package in the same Julia session). For this you can use:
julia> using Pkg
(@v1.5) pkg> st DataFrames
Status `D:\.julia\environments\v1.5\Project.toml`
[a93c6f00] DataFrames v0.22.2
julia> Pkg.TOML.parsefile(joinpath(String(first(methods(getfield(DataFrames, :eval))).file), "..", "..", "Project.toml"))["version"]
"0.22.1"
(in this example I have first loaded DataFrames.jl 0.22.1 then after having loaded it upgraded it to 0.22.2)
(you can have find more details why this is needed and when it fails here)
Upvotes: 5