0

I am working on windows10 and am using python with anaconda.I have the following code as a part of an svd_dgesvd code:

import numpy as np
import ctypes
from ctypes import CDLL, POINTER, c_int, byref, c_char, c_double
import sys
from numpy.core import array, asarray, zeros, empty, transpose, \
    intc, single, double, csingle, cdouble, inexact, complexfloating, \
    newaxis, ravel, all, Inf, dot, add, multiply, identity, sqrt, \
    maximum, flatnonzero, diagonal, arange, fastCopyAndTranspose, sum, \
    isfinite, size

libs = ["libLAPACK.dylib","libmkl_rt.so","libmkl_intel_lp64.so","liblapack.so"]

lib = None
for l in libs:
try:
    lib = CDLL(l)
    print "Loaded " + l +  " for dgesvd"
    break
except OSError:
    pass

if lib==None:
raise OSError, "Couldn't find lapack library for GESVD patch"

sadly at the end of this code lib stays none and I get the error. It seems that I don't have lapack. How do I download and istall lapack correctly in such a case?

Thanks!

ali_m
  • 71,714
  • 23
  • 223
  • 298
Eyal Leviatan
  • 49
  • 1
  • 2
  • In Windows shared libraries have the suffix `.dll` rather than `.so`, `.dylib` etc. You could use [`ctypes.util.find_library('lapack')`](https://docs.python.org/2/library/ctypes.html#finding-shared-libraries) to find the correct file name. If `find_library` returns nothing then it probably means that the shared library is not in the system search path ([see here](http://stackoverflow.com/a/6475912/1461210)). – ali_m Oct 18 '15 at 13:24
  • By the way, you should fix your indentation – ali_m Oct 18 '15 at 15:09

0 Answers0