PMEAL / OpenPNM

A Python package for performing pore network modeling of porous media
http://openpnm.org
MIT License
449 stars 174 forks source link

Issue with PyPardiso while running permeability algorithm #2618

Closed ruchajk2597 closed 1 year ago

ruchajk2597 commented 1 year ago

I am trying to run the code to determine absolute permeability. image ![Uploading image.png…]() FileNotFoundError Traceback (most recent call last)

in 32 perm.set_value_BC(pores=pn.pores('ymax'), values=0) 33 perm.set_value_BC(pores=pn.pores('ymin'), values=Pressure) ---> 34 perm.run() 35 Q = perm.rate(pores=pn.pores('ymin'), mode='group') 36 K = Q * mu / (A * delta_P*density) ~\anaconda3\lib\site-packages\openpnm\algorithms\ReactiveTransport.py in run(self, x0) 160 x0 = np.zeros(self.Np, dtype=float) if x0 is None else x0 161 self["pore.initial_guess"] = x0 --> 162 x = self._run_reactive(x0) 163 self[quantity] = x 164 ~\anaconda3\lib\site-packages\openpnm\algorithms\ReactiveTransport.py in _run_reactive(self, x0) 349 for itr in range(max_it): 350 # Solve, use relaxation, and update solution on algorithm obj --> 351 self[quantity] = x = self._solve(x0=x) * w + x * (1 - w) 352 self._update_A_and_b() 353 # Check solution convergence ~\anaconda3\lib\site-packages\openpnm\algorithms\GenericTransport.py in _solve(self, A, b, x0) 619 620 # Fetch solver object based on settings dict. --> 621 solver = self._get_solver() 622 x = solver(A, b, atol=atol, rtol=rtol, max_it=max_it, x0=x0) 623 ~\anaconda3\lib\site-packages\openpnm\algorithms\GenericTransport.py in _get_solver(self) 675 elif self.settings['solver_family'] == 'pypardiso': 676 try: --> 677 import pypardiso 678 except ModuleNotFoundError: 679 if self.Np <= 8000: ~\anaconda3\lib\site-packages\pypardiso\__init__.py in 2 3 from .pardiso_wrapper import PyPardisoSolver ----> 4 from .scipy_aliases import spsolve, factorized 5 from .scipy_aliases import pypardiso_solver as ps 6 ~\anaconda3\lib\site-packages\pypardiso\scipy_aliases.py in 7 # pypardsio_solver is used for the 'spsolve' and 'factorized' functions. Python crashes on windows if multiple 8 # instances of PyPardisoSolver make calls to the Pardiso library ----> 9 pypardiso_solver = PyPardisoSolver() 10 11 ~\anaconda3\lib\site-packages\pypardiso\pardiso_wrapper.py in __init__(self, mtype, phase, size_limit_storage) 64 self.libmkl = ctypes.CDLL('libmkl_rt.dylib') 65 elif sys.platform == 'win32': ---> 66 self.libmkl = ctypes.CDLL('mkl_rt.dll') 67 else: 68 self.libmkl = ctypes.CDLL('libmkl_rt.so') ~\anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode) 379 380 if handle is None: --> 381 self._handle = _dlopen(self._name, mode) 382 else: 383 self._handle = handle FileNotFoundError: Could not find module 'mkl_rt.dll' (or one of its dependencies). Try using the full path with constructor syntax. I am getting the error " Could not find module 'mkl_rt.dll' (or one of its dependencies). Try using the full path with constructor syntax." This same code used to run on my previous machine but not on this. I tried downgrading scipy but it does not help either. Can you please help me fix it. It is a little urgent from my side and I was not expecting this to throw errors as it ran on my other laptop. Looking forward to hearing from you. Thanks Best Regards, Rucha
jgostick commented 1 year ago

Pypardiso is always cropping up a problem...if pardiso wasn't so great we'd abandon it. Can you tell me what version of openpnm you're using with op.__version__?

ma-sadeghi commented 1 year ago

@ruchajk2597 Also please paste the output of conda list (run it in Anaconda prompt).

haasad commented 1 year ago

Please update pypardiso. Based on that stacktrace you're using an ancient version of pypardiso, this looks like 0.2.2 which was released almost six years ago.

jgostick commented 1 year ago

@haasad thanks for the input...how did you get the pypardiso version number from this traceback? I can't see it anywhere.

haasad commented 1 year ago

https://github.com/haasad/PyPardisoProject/compare/v0.2.2...v0.3.0#diff-464e9cd4aee7065154a38afe964234b985e4b84d421881762f187a03950bb2eaL62-L68

ma-sadeghi commented 1 year ago

@jgostick It's because of this line in the traceback:

self.libmkl = ctypes.CDLL('mkl_rt.dll')

In versions < 0.3.0, "mkl_rt.dll" used to be hard-coded, now it's found in a more robust and automatic fashion.