Torch.gesv MAGMA library not found in compilation

I am using PyTorch on Windows 10, with Python 3.6.6 and Cuda 9.0.

I would like to make batch inversion of matrices. Since this is not supported by torch.inverse, I use the following:

def b_inv(b_mat):
    eye = b_mat.new_ones(b_mat.size(-1)).diag().expand_as(b_mat)
    b_inv, _ = torch.gesv(eye, b_mat)
    return b_inv


But I get the following error:
torch.gesv MAGMA library not found in compilation. Please rebuild with MAGMA.

What does that mean? Does it mean PyTorch has to be built from sources to use MAGMA?

The above issue was happening using Pytorch installed using pip.

I switched to a Conda installation, using the Python 3.7/Cuda 9.0 version.
And this solved the problem for me (I don’t know why exactly…).