Skip to content

Installing Slycot (openmp) breaks numpy #230

@chnce

Description

@chnce

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
    • ipython
  • paste and run the code below to confirm it works as expected (raises LinAlgError)
  • exit ipython
    • exit
  • 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions