Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine version of a specific package

Tags:

julia

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.

like image 917
Julian Avatar asked Sep 03 '14 02:09

Julian


People also ask

How do I check a specific package version?

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.

How do I find the specific version of a python package?

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.

What is __ version __ in Python?

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).

How do I check the version of an R package?

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.


1 Answers

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 
like image 87
6 revs, 2 users 70% Avatar answered Oct 11 '22 15:10

6 revs, 2 users 70%