1

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'

denis
  • 21,378
  • 10
  • 65
  • 88

1 Answers1

1

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.
denis
  • 21,378
  • 10
  • 65
  • 88
  • @Christian: how did you solve this? I tried with a custom numpy-site, but I haven't got past the errors – charles Dec 22 '22 at 06:12
  • 1
    I have tried following your instructions, and the installation seems successful (the installed umfpack libraries are found during the process). However, upon import, I get this error now: ImportError: cannot import name '_umfpack' from partially initialized module 'scikits.umfpack' (most likely due to a circular import). Any ideas on how to solve it? – charles Dec 22 '22 at 06:23
  • @charles, if you're on MacOS maybe I could help (see `man dyld`), if not not, sorry, I have only a Mac. In any case can you put up exactly what you did, your `~/.numpy-site.cfg` and error message (as an answer, too long for a comment). – denis Dec 22 '22 at 17:15