How can I get the version number for a specific package?
The obvious way is to get the dictionary with all installed packages, and then filter for the one of interest:
pkgs = Pkg.installed(); pkgs["Datetime"]
Getting the list of all installed packages is very slow though, especially if there are many packages.
Checking if a specific package is installed using dpkg-query: The dpkg-query command can be used to show if a specific package is installed in your system. To do it, run dpkg-query followed by the -l flag and the name of the package you want information about.
To get the version of a package used in a Python script, use the __version__ attribute. The __version__ attribute is recommended by PEP (Python Enhancement Proposals), and many packages have it. Note that the __version__ attribute is not mandatory, so some packages do not have it.
It provides a __version__ attribute. It provides the standard metadata version. Therefore it will be detected by pkg_resources or other tools that parse the package metadata (EGG-INFO and/or PKG-INFO, PEP 0345).
1 Answer. You can use the packageVersion() function to print version information about the loaded packages. To print the version information about R, the OS and attached or loaded packages, use the sessionInfo() function.
EDIT: For Julia version 1.1+
Use the Pkg REPL notation:
] status # Show every installed package version ] status pkgName # Show the specific version of the package ] status pkgName1 pkgName2 # Show the named packages. You can continue the list.
The ]
enters the Pkg REPL, so you basically write status ...
So in your case, write after entering the Pkg REPL:
status DataFrame
Or use the object-oriented approach (NB: Here you don't enter the Pkg REPL, i.e. DON'T use ]
:
Pkg.status("DataFrame")
EDIT: For Julia version 1.0
Pkg.installed
seems to have "regressed" with the new package system. There are no arguments for Pkg.installed
. So, the OP's original method seems to be about the best you can do at the moment.
pkgs = Pkg.installed(); pkgs["Datetime"]
EDIT: For Julia version upto 0.6.4
You can pass a string to Pkg.installed
. For example:
pkgs = Pkg.installed("JuMP")
I often check available calling arguments with methods
. For example:
julia> methods(Pkg.installed) # 2 methods for generic function "installed": installed() at pkg/pkg.jl:122 installed(pkg::AbstractString) at pkg/pkg.jl:129
or
julia> Pkg.installed |> methods # 2 methods for generic function "installed": installed() at pkg/pkg.jl:122 installed(pkg::AbstractString) at pkg/pkg.jl:129
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With