How to resolve runtime error related to compile PyTorch with LAPACK support?

I am running DNN model on synthetic datasets to draw decision boundaries polytope in order to study the tropical geometrical perspective of synthetic adversarial attack. And getting the following runtime error:

 Cell In[26], line 20
     17 sigma      = 0  #Sparsity Factor, CAUTION, this number should be less than epsilon1 otherwise, no   solution will be found
     19 print(f'The model was classifing the x_0 as class {model_new(x_0).unsqueeze(dim=0).argmax(1).item()}, The target class is {target.item()}')
---> 20 delta_x,z,w,delta_a,eqq = str_atk_tg_for_syn(model_new,x_0,target,criterion,epsilon1,epsilon2,rho,eta,lamda,sigma,iterations)
     21 print(f'The attacked model is now classifying x_0 as class {model_new(x_0+delta_x).unsqueeze(dim=0).argmax(1).item()}')

Cell In[14], line 36, in str_atk_tg_for_syn(net, x, target, criterion, eps1, eps2, rho_0, eta, lamda, sigma, iterations)
     34 temp2   = 2*lamda*torch.mm(torch.mm(A.t(),delta_a),x.squeeze().reshape(-1,1))
     35 temp2   = temp2.reshape(z.shape) + rho*z.squeeze() - u.squeeze() # This is the    B in Ax = B
---> 36 delta,_ = torch.linalg.solve(temp1, temp2.reshape(-1,1))
     37 delta   = delta.reshape(z.shape)
     39 #Updating w
RuntimeError: Calling torch.linalg.lu_factor on a CPU tensor requires compiling PyTorch with LAPACK. Please use PyTorch built with LAPACK support.

I installed LAPACK and related packages in anaconda environment using

conda install -c “conda-forge/label/lapack_rc” lapack

command but still getting this runtime error. How can I compile Pytorch with LAPACK support?

I am a newbie but my wild guess is that you are running the code on cpu what you need is mkl and mkl-include and, if you are using gpu, you need magma.

Then recompile.