Installing PyPardiso

Update 5th June 2022: The PyPardiso package may now be installed simply with pip (see Installing PyPardiso and speed of Scipy spsolve):

  • Install the MKL library: pip install mkl
  • Install PyPardiso: pip install pypardiso

The PyPardiso package provides an interface to the Intel MKL Pardiso library to solve large sparse linear systems of equations. Trying to install this package with Conda raises the message:

To search for alternate channels that may provide the conda package you’re
looking for, navigate to https://anaconda.org and use the search bar at the top of the page.

This provides the link: https://anaconda.org/haasad/pypardiso

which provides the command line:

conda install -c haasad pypardiso

Ensure that the Intel MKL library is installed before installing pypardiso.

The pypardiso Github site is at:https://github.com/haasad/PyPardisoProject

This provides the following documentation:

I have now modified my py_spsolve function to use the PyPardiso solver by default:

@xl_func(disable_function_wizard_calc=True)
@xl_func(category = "Scipy-Linalg")
@xl_arg('v', 'numpy_array', ndim=1)
@xl_arg('i', 'numpy_array', ndim=1)
@xl_arg('j', 'numpy_array', ndim=1)
@xl_arg('ya', 'numpy_array', ndim=1)
@xl_return('numpy_array')
def py_spsolve(v, i, j, ya, out = 0, use_pardiso = True, permc_spec = 'MMD_AT_PLUS_A'):
    """
    Solve a matrix equation Ax = y in sparse COO format.
:param v: value vector
:param i: row index vector
:param j: column index vector
:param ya: y vector
    """
    timea = np.zeros((1,2))
    stime =time.perf_counter()
    n = ya.size
    A = ssp.coo_matrix((v,(i,j)),shape=(n,n)).tocsc()
    timea[0,0] = time.perf_counter()-stime
    if use_pardiso:
        res = spsolve(A, ya)
    else:
        res = sspla.spsolve(A, ya, permc_spec)
    timea[0,1] = time.perf_counter()-stime
    if out == 1:
        return timea
    else:
        return res

This entry was posted in Excel, Finite Element Analysis, Frame Analysis, Link to Python, Newton, NumPy and SciPy, PyXLL, UDFs and tagged , , , , , , . Bookmark the permalink.

1 Response to Installing PyPardiso

  1. Pingback: Installing PyPardiso and speed of Scipy spsolve | Newton Excel Bach, not (just) an Excel Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.