ARPACK no longer works on M2 Mac (OS 13.5)

41 Views Asked by At

My question is how to update Python code that uses scipy's ARPACK routines to compute eigenvalues so that it runs with the current version of scipy. I think, if I understood correctly, that computation of eigenvalues in scipy has changed and that this requires a different way of calling these routines.

Warning: my questions may not be posed correctly. I am using and editing code that a colleague previously wrote, and I am barely a beginner in python coding.

I have a set of python data analysis routines (written by a colleague who is no longer available) that run fine on an Intel Mac running Monterey (Mac OS 12), running Jupyter Notebook via Anaconda Navigator. I am trying to run the same routines on an M2 Macbook Air runnning Ventura (OS 13.5.2). I installed the current (December 2023) version of Anaconda Navigator to run Python via Jupyter Notebook. When execution hits the line:

from scipy.sparse.linalg.eigen.arpack import eigsh as largest_eigsh

I get the error message:

      1 import numpy as np
----> 2 from scipy.sparse.linalg.eigen.arpack import eigsh as largest_eigsh
      3 #from scipy.linalg import eigh as largest_eigh
      5 from project_fog.settings import DetectorModule

ModuleNotFoundError: No module named 'scipy.sparse.linalg.eigen.arpack'; 'scipy.sparse.linalg.eigen' is not a package

A sample line of code that uses eigenvalue computations is:

            _, ua_i = largest_eigsh(Ga_new, 1, which='LM')

I looked at the following webpage on scipy's documentation website, but even after reading this I am not sure how to rewrite the line:

from scipy.sparse.linalg.eigen.arpack import eigsh as largest_eigsh

into an updated form that is acceptable to scipy.

Any suggestions?

0

There are 0 best solutions below