Module not found error when importing umfpack MacOS Monterey M1 chip

725 views Asked by At

I installed umfpack using pip install scikit-umfpack and tried importing the umfpack module

from scikits import umfpack

I'm running into the following error:

Traceback (most recent call last):
  File "/Users/christianadib/pyfrbus_package/venv/lib/python3.9/site-packages/scikits/umfpack/_umfpack.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('__umfpack', [dirname(__file__)])
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '__umfpack'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/christianadib/pyfrbus_package/venv/lib/python3.9/site-packages/scikits/umfpack/__init__.py", line 12, in <module>
    from .umfpack import *
  File "/Users/christianadib/pyfrbus_package/venv/lib/python3.9/site-packages/scikits/umfpack/umfpack.py", line 130, in <module>
    from . import _umfpack as _um
  File "/Users/christianadib/pyfrbus_package/venv/lib/python3.9/site-packages/scikits/umfpack/_umfpack.py", line 28, in <module>
    __umfpack = swig_import_helper()
  File "/Users/christianadib/pyfrbus_package/venv/lib/python3.9/site-packages/scikits/umfpack/_umfpack.py", line 20, in swig_import_helper
    import __umfpack
ModuleNotFoundError: No module named '__umfpack'

1

There are 1 answers

3
denis On BEST ANSWER

Christian, it's not easy:

  1. pypi umfpack says: first build a local SuiteSparse UMFPACK
  2. building SuiteSparse libraries requires some knowledge of Makefiles
    and on macos otool / install_name_tool
  3. before pip install, you need a suitable ~/.numpy-site.cfg.
    Added: the setup.py is old and messy; I had a simpler one which worked onceaponatime, let me know.

You could also try `conda install scikit-umfpack` instead of `pip`, BUT mixing different package managers is asking for trouble; if you do, keep the pip and conda package trees separate.