How to test if package is installed

I find myself needing to test whether a package is installed with the release of Julia v1.7 running on Mac with Apple Silicon. One of the packages I normally use is not yet compatible with Apple Silicon, so for now I’m using the python version via PyCall. I’d like my code to handle both scenarios so I need to determine whether the Julia version of the package is installed or not. If not, use the python version. Maybe this is a short term issue but I support having Pkg.installed retained in Pkg.

For me, I can avoid any warning by using

"somepackage" ∈ keys(Pkg.project().dependencies)

instead of:

In this way I avoid the depreciation warning I get otherwise. :slight_smile:

That no longer works:

isinstalled(Flux) = pkg != "METADATA" && pkg != "REQUIRE" && pkg[1] != '.' &&, pkg)

isinstalled (generic function with 1 method)