After installing pysparse
with Python version 2.7.15:
$ pyenv local 2.7.15
$ pip install pysparse==1.2-dev213
I tried to test the installation as shown at the pysparse
home page. But when I run the test
testSuperlu.py
, I get the following error:
Traceback (most recent call last):
File "testSuperlu.py", line 3, in <module>
from pysparse.tools import poisson
File "/home/hakon/.pyenv/versions/2.7.15/lib/python2.7/site-packages/pysparse/__init__.py", line 6, in <module>
from numpy._import_tools import PackageLoader
ImportError: No module named _import_tools
It seems like numpy._import_tools
is missing. I am using
numpy
version 1.16.0.
Edit:
After following the advice from @wd15 in their answer below, i.e. installing different versions of pyparse
and numpy
:
$ pip install pysparse==1.1.1-dev
$ pip install numpy==1.15.1
Then running the test program testSuperlu.py
again:
$ python testSuperlu.py
ImportError: No module named _multiarray_umath
Traceback (most recent call last):
File "testSuperlu.py", line 3, in <module>
from pysparse.tools import poisson
File "/home/hakon/.pyenv/versions/2.7.15/lib/python2.7/site-packages/pysparse/__init__.py", line 9, in <module>
from sparse import spmatrix
File "/home/hakon/.pyenv/versions/2.7.15/lib/python2.7/site-packages/pysparse/sparse/__init__.py", line 6, in <module>
from pysparseMatrix import *
File "/home/hakon/.pyenv/versions/2.7.15/lib/python2.7/site-packages/pysparse/sparse/pysparseMatrix.py", line 57, in <module>
from pysparse.sparse import spmatrix
ImportError: numpy.core.multiarray failed to import
FiPy now has a Nix recipe, which fixes the versions of PySparse and Numpy to be compatible. The Nix recipe uses version 1.1.1-dev of PySparse (hosted here) along with version 1.15.1 of Numpy (hosted here).
If you don't want to use the Nix environment then my recommendation would be to set up a Python 2 environment with those specific versions of Numpy and PySparse.