haasad / PyPardiso

Python interface to the Intel MKL Pardiso library to solve large sparse linear systems of equations
BSD 3-Clause "New" or "Revised" License
133 stars 20 forks source link

Error on Windows #66

Closed fbordeu closed 6 months ago

fbordeu commented 7 months ago

Hi

I have an installation of python + mkl + pypardiso using conda-forge and I cant make pardiso to work on the example. This is a log to reproduce the problem.

Any ideas??? Thanks

C:\Users\XXXXXXX>mamba create -n PT python=3.9 mkl numpy scipy pypardiso

Looking for: ['python=3.9', 'mkl', 'numpy', 'scipy', 'pypardiso']

conda-forge/noarch 85.0MB @ 5.9MB/s 14.5s conda-forge/win-64 153.4MB @ 5.0MB/s 30.9s Transaction

Prefix: C:\Users\XXXXXXX\AppData\Local\miniforge3\envs\PT

Updating specs:


Confirm changes: [Y/n] Y Downloading and Extracting Packages:

Preparing transaction: done Verifying transaction: done Executing transaction: done

To activate this environment, use

 $ mamba activate PT

To deactivate an active environment, use

 $ mamba deactivate

C:\Users\XXXXXXX>mamba activate PT

C:\Users\XXXXXXX>python Python 3.9.18 | packaged by conda-forge | (main, Dec 23 2023, 16:29:04) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import pypardiso import numpy as np import scipy.sparse as sp A = sp.rand(10, 10, density=0.5, format='csr') A <10x10 sparse matrix of type '<class 'numpy.float64'>' with 50 stored elements in Compressed Sparse Row format> b = np.random.rand(10) x = pypardiso.spsolve(A, b) Traceback (most recent call last): File "", line 1, in File "C:\Users\XXXXXXX\AppData\Local\miniforge3\envs\PT\lib\site-packages\pypardiso\scipy_aliases.py", line 46, in spsolve solver.factorize(A) File "C:\Users\XXXXXXX\AppData\Local\miniforge3\envs\PT\lib\site-packages\pypardiso\pardiso_wrapper.py", line 164, in factorize self._call_pardiso(A, b) File "C:\Users\XXXXXXX\AppData\Local\miniforge3\envs\PT\lib\site-packages\pypardiso\pardiso_wrapper.py", line 277, in _call_pardiso self._mkl_pardiso(self.pt.ctypes.data_as(ctypes.POINTER(self._pt_type[0])), # pt OSError: [WinError -1066598273] Windows Error 0xc06d007f

ghsilva commented 7 months ago

Long story short, I believe using MKL version 2023.2.0 or older should solve this problem while we are working in a patch release for the intel-openmp 2024.0.*

fbordeu commented 7 months ago

Thanks for the hint,

I'm going to try lowering the version of intel-openmp. So this problem also exists on others OS(Linux)?

Thanks for the help

ghsilva commented 7 months ago

Note that MKL 2024. requires Intel-openmp 2024. so you will need to lower the MKL version as well. The issue happens only on Windows.

fbordeu commented 7 months ago

Exactly, mamba did the correct job of keeping my env functional by lowering ihe intel-openmp and the mkl.

Thanks,

haasad commented 7 months ago

I have now also released pypardiso v0.4.4 on conda-forge, which pins MKL to <2024, see https://github.com/conda-forge/pypardiso-feedstock/pull/9