Wolfram Research

Function Repository Resource:

PythonPackageInstalledQ

Source Notebook

Test if the Python package can be accessed in your session

Contributed by: Arnoud Buzing

ResourceFunction["PythonPackageInstalledQ"][name]

gives True if the Python package name is installed, and False otherwise.

ResourceFunction["PythonPackageInstalledQ"][python,name]

checks if the package is installed for the given installation.

Examples

Basic Examples

Check if the specified Python package is installed:

In[1]:=
ResourceFunction["PythonPackageInstalledQ"]["wheel"]
Out[1]=
In[2]:=
ResourceFunction["PythonPackageInstalledQ"]["svglib"]
Out[2]=

Check a particular Python session:

In[3]:=
session = StartExternalSession["Python"]
Out[3]=
In[4]:=
ResourceFunction["PythonPackageInstalledQ"][session, "svglib"]
Out[4]=
In[5]:=
DeleteObject[session]

Check a specific Python installation using a path:

In[6]:=
path = ResourceFunction["FindPythonExecutable"][]
Out[6]=
In[7]:=
ResourceFunction["PythonPackageInstalledQ"][path, "pip"]
Out[7]=

Resource History

Related Resources

License Information