ntucllab / libact

Pool-based active learning in Python
http://libact.readthedocs.org/
BSD 2-Clause "Simplified" License
777 stars 175 forks source link

Windows compiled ok, but can't run #180

Open happydpc opened 4 years ago

happydpc commented 4 years ago

modified_files.zip

Here are the steps(All the files are in the zip file):

(1) Download the liblapack.lib and liblapacke.lib , and headers LAPACKE header file, LAPACKE mangling header file, liblapack.dll, liblapacke.dll (2) Change the variance_reduction.c to variance_reduction.cpp , and change the part to

#include <complex>

#define LAPACK_COMPLEX_CUSTOM
#define lapack_complex_float std::complex<float>
#define lapack_complex_double std::complex<double>

#include <Python.h>
#include <numpy/arrayobject.h>
#include <lapacke.h>

/* DGESVD prototype */
extern "C" void LAPACK_dgesvd( char* jobu, char* jobvt, int* m, int* n, double* a,
                    int* lda, double* s, double* u, int* ldu, double* vt, int* ldvt,
                    double* work, int* lwork, int* info )

(3) Change the setup.py file to :

   else:
        # assume linux otherwise, unless we support Windows in the future...
        print("Platform Detection: Linux. Link to liblapacke...")
        extra_link_args = []
        include_dirs = [(numpy.distutils.misc_util.get_numpy_include_dirs() +
                        ['/usr/include/']), "your_header_directory"]  #Change the header directory
        libraries = ['liblapacke', 'liblapack']
        library_dirs = ['D:/tools/LAPACK_3.1.1_for_Windows_VS/lib/x64']  #This is the lib directory

(4) Run: python setup.py install (5) Put the dll files like this image

yangarbiter commented 4 years ago

Is there any error message that might suggest why it can't run?

happydpc commented 4 years ago

The python's pyd file can't load. There may exist some dependencies error.

brightgems commented 3 years ago

In my knowledge, the best way to install on windows is disable compile variance_reduction. Current version of setup.py allow to achieve this purpose by set env LIBACT_BUILD_VARIANCE_REDUCTION=0.