After installing slycot in a conda environment, a kernel crash occurs when trying to solve a linear system with a singular matrix.
I narrowed the issue down to the following:
- slycot from conda-forge depends on libflang >=5.0.0,<6.0.0.a0
- libflang 5.0.0 depends on openmp 5.0.0
- openmp 5.0.0 overwrites "libiomp5md.dll" that was installed by numpy. The two dlls are very different in size (2mb for the numpy one, 600kb for the openmp one)
Openmp places its "libiomp5md.dll" in Library\bin.
The version from numpy is either in Library\bin (channel main) or directly in bin (conda-forge).
Actual Behavior
Using numpy.linalg.solve on singular matrix with dimension over 149 crashes the Kernel.
Expected Behavior
Expected a "LinAlgError: Singular matrix" as it is shown with matrices up to the dimension of 149.
Steps to Reproduce
- Create a new conda environment with python 3.11, numpy (and ipython for convenience)
mamba create -n slycot_crash python=3.11 numpy ipython -c conda-forge
- activate the environment
mamba activate slycot_crash
- enter ipython
- paste and run the code below to confirm it works as expected (raises LinAlgError)
- exit ipython
- install openmp=5
mamba install openmp=5 -c conda-forge
- enter ipython and run the code below again to confirm kernel crash
- (optional) change n=149 and it only fails if the size is 150 or larger
import numpy as np
n = 150
A = np.random.rand(n,n)
A[-1,:] = np.zeros((1,n)) # make matrix singular
b = np.random.rand(n)
x = np.linalg.solve(A, b)
After installing slycot in a conda environment, a kernel crash occurs when trying to solve a linear system with a singular matrix.
I narrowed the issue down to the following:
Openmp places its "libiomp5md.dll" in Library\bin.
The version from numpy is either in Library\bin (channel main) or directly in bin (conda-forge).
Actual Behavior
Using numpy.linalg.solve on singular matrix with dimension over 149 crashes the Kernel.
Expected Behavior
Expected a "LinAlgError: Singular matrix" as it is shown with matrices up to the dimension of 149.
Steps to Reproduce
mamba create -n slycot_crash python=3.11 numpy ipython -c conda-forgemamba activate slycot_crashipythonexitmamba install openmp=5 -c conda-forge