# libact Installation Manual ###### tags: `libact` ## Windows 10 (<span style="color:red">Fail!</span>) Based on Anaconda. Reference: [Install Cython](https://stackoverflow.com/questions/52864588/how-to-install-cython-an-anaconda-64-bits-with-windows-10), [Install with lapacke for Windows](https://github.com/ntucllab/libact/issues/180). Step 1. Setup python dependencies. ```powershell= conda create -n py36 python=3.6 conda activate py36 (py36) pip install -r requirements.txt (py36) conda install -c conda-forge lapack (py36) conda install -c conda-forge liblapacke ``` Step 2. Setup **Mingw-w64** compiler for Windows env. ```powershell= (py36) conda install -c anaconda cython ``` 1. Add `distutils.cfg` to `C:\Users\$[home]\anaconda3\envs\py36\Lib\distutils` with ```config= [build] compiler=mingw32 ``` 2. Install [latest version of Mingw-w64](https://nchc.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe) and add `C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin` to system path. 3. Install `libpython` and `m2w64-toolchain`. ```powershell= (py36) conda install -c anaconda libpython (py36) conda install -c msys2 m2w64-toolchain ``` Step 3. Update `libact` and `lapack` dependencies tools for Windows. 1. Download [srcs, libs and headers](https://github.com/ntucllab/libact/files/4918141/modified_files.zip). 2. Change the `variance_reduction.c` to `variance_reduction.cpp`. 3. Change the `setup.py` file, remember change the path of headers you download before. ```powershell= 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 ``` Step 4. Install `libact`. ```powershell= (py36) python setup.py install ``` - Test (<span style="color:red">You need to stop by killing process</span>.) Download [libact-variation_reduction-eg.py](https://gist.github.com/ariapoy/86522f967b7b7409d9b9bc1fc1bda495) and corresponding dataset. ```powershell (py36) python libact-variation_reduction-eg.py File "C:\Users\lupoy\anaconda3\envs\libact-ariapoy\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main is not going to be frozen to produce an executable.''') RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase. This probably means that you are not using fork to start your child processes and you have forgotten to use the proper idiom in the main module: if __name__ == '__main__': freeze_support() ... The "freeze_support()" line can be omitted if the program is not going to be frozen to produce an executable. # ERROR occurs when using `estVar()` ``` I haven't compile to get `_variance_reduction.cp36-win_amd64.pyd` correctly. ## Linux. CentOS 8.4.2105 Step 1. Setup CentOS env & python dependencies. ```bash= dnf update dnf group install "Development Tools" dnf install gcc-gfortran atlas-devel lapack dnf --enablerepo=powertools install lapack-devel dnf install python3 python3-devel git clone https://github.com/ntucllab/libact.git; cd libact pip3 install -r requirements.txt ``` Step 2. Setup absolute path of ```lapacke.h``` ```shell= vim libact/query_strategies/src/variance_reduction/variance_reduction.c # Line 5 # #include <lapacke.h> => #include </usr/include/lapacke/lapacke.h> ``` Step 3. Install ```libact``` ```shell= pip3 install . ``` Step 4. Test ```libact``` ```shell= python3 setup.py test ``` 1. Download [compiled lapack tools](https://github.com/ntucllab/libact/files/4918141/modified_files.zip) and follow the [steps](https://github.com/ntucllab/libact/issues/180).