Xiaocheng
Xiaocheng

Reputation: 21

How can I install full-functional Shogun in Anaconda virtual environment without root privilege?

I am a beginner, and I have met some questions in the process of installing shogun manually.

The situation is that I am going to build an MKL-SVM model with shogun's Python interface, so I installed shogun via conda:

conda install shogun

As you can imagine, I installed it seeming safely and smoothly, but when I called this package in my project, it spewed out that the function shogun.SVMLight() was missing:

AttributeError: module 'shogun' has no attribute 'SVRLight'

I searched for this error info, and got some advice, but it not working. Therefore, I returned to the official install manual, and several sentences caught my attention:

Anaconda packages include most of the optional dependencies, but not all.

Author suggests to compile by hand.

As a result, I set out my long journey, abound with endless dependencies missing or incompatible version. My install steps are as follows:

conda create -n shogun python=3.6
conda activate shogun
conda install cmake 
conda install -c creditx gcc-7
# conda install a series of other dependencies

# download source code and GPL license
git clone https://github.com/shogun-toolbox/shogun.git
cd shogun/src
git clone https://github.com/shogun-toolbox/shogun-gpl.git
cp shugun-gpl/* gpl/ -R

cd ..
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/export/home/zhouxiaocheng/miniconda3/envs/shogun -DPYTHON_EXECUTABLE=/export/home/zhouxiaocheng/miniconda3/envs/shogun/bin/python -DPYTHON_INCLUDE_DIR=/export/home/zhouxiaocheng/miniconda3/envs/shogun/include/python3.6m -DPYTHON_LIBRARY=/export/home/zhouxiaocheng/miniconda3/envs/shogun/lib/libpython3.6m.so -DINTERFACE_PYTHON=ON ..

Then, I got some error tips:

-- Summary of Configuration Variables
-- The following OPTIONAL packages have been found:

 * CCache
 * Doxygen (required version >= 1.8.6)
 * rxcpp
 * spdlog
 * Protobuf
 * HDF5
 * CURL
 * ZLIB
 * BZip2
 * LibLZMA
 * NLopt
 * Ctags
 * Sphinx
 * Pandoc

-- The following REQUIRED packages have been found:

 * SWIG (required version >= 3.0.12)
 * Threads
 * PythonLibs (required version == 3.6.10)
 * NumPy (required version >= 1.7)
 * PythonInterp
 * PLY

-- The following OPTIONAL packages have not been found:

 * OpenMP
 * CxaDemangle
 * Eigen3 (required version >= 3.1.2)
 * ViennaCL (required version >= 1.5.0)
 * TFLogger (required version >= 0.1.0)
 * BLAS
 * GLPK
 * LibArchive
 * CPLEX
 * ARPACK
 * Mosek
 * SNAPPY
 * LZO
 * LpSolve
 * ColPack
 * ARPREC

-- ===================================================================================================================
-- Integrations
--   OpenCV Integration is OFF   enable with -DOpenCV=ON
-- ===================================================================================================================
-- Interfaces
--   Python is ON
--   Octave is OFF               enable with -DINTERFACE_OCTAVE=ON
--   Java is OFF                 enable with -DINTERFACE_JAVA=ON
--   Perl is OFF                 enable with -DINTERFACE_PERL=ON
--   Ruby is OFF                 enable with -DINTERFACE_RUBY=ON
--   C# is OFF                   enable with -DINTERFACE_CSHARP=ON
--   R is OFF                    enable with -DINTERFACE_R=ON
--   Scala is OFF                enable with -DINTERFACE_SCALA=ON
--   CoreML is OFF               enable with -DINTERFACE_COREML=ON
-- ===================================================================================================================
-- To compile shogun type
--   make
-- 
-- To install shogun to /export/home/zhouxiaocheng/miniconda3/envs/shogun type
--   make install
-- 
-- or to install to a custom directory
--   make install DESTDIR=/my/special/path
--   (or rerun cmake with -DCMAKE_INSTALL_PREFIX=/my/special/path) to just change the prefix
-- ===================================================================================================================
-- Configuring done
CMake Warning at src/shogun/CMakeLists.txt:125 (add_library):
  Cannot generate a safe runtime search path for target shogun because files
  in some directories may conflict with libraries in implicit directories:

    runtime library [libcurl.so.4] in /export/home/zhouxiaocheng/miniconda3/envs/shogun/lib may be hidden by files in:
      /usr/local/lib
    runtime library [liblzma.so.5] in /export/home/zhouxiaocheng/miniconda3/envs/shogun/lib may be hidden by files in:
      /usr/local/lib

  Some of these libraries may not be found correctly.

I ignored these error info and executed:

make install

It returned back:

[  0%] Built target ShogunVersionProtobuf
[  1%] Generating version header
[  1%] Built target version
[  1%] Generating /export/home/zhouxiaocheng/software/shogun/build/src/shogun/base/class_list.cpp
[  1%] Built target class_list
[  2%] Built target RapidJSON
[  2%] Built target ChunksProtobuf
[  3%] Built target bitsery
[  3%] Performing install step for 'Eigen3'
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /export/home/zhouxiaocheng/software/shogun/build/src/shogun/third_party/eigen/signature_of_eigen3_matrix_library
CMake Error at cmake_install.cmake:65 (file):
  file cannot create directory: /usr/local/share/eigen3/cmake.  Maybe need
  administrative privileges.


make[3]: *** [install] Error 1
make[2]: *** [Eigen3/src/Eigen3-stamp/Eigen3-install] Error 2
make[1]: *** [src/shogun/CMakeFiles/Eigen3.dir/all] Error 2
make: *** [all] Error 2

How can I resolve this, so I could call the SVMLight() function successfully?

Updated

I changed a former version, v6.1.3, and tried the procedure again. Some different errors emerged.

Scanning dependencies of target libshogun
[  2%] Building CXX object src/shogun/CMakeFiles/libshogun.dir/base/Parallel.cpp.o
[  2%] Building CXX object src/shogun/CMakeFiles/libshogun.dir/base/Parameter.cpp.o
[  2%] Building CXX object src/shogun/CMakeFiles/libshogun.dir/base/SGObject.cpp.o
/export/home/zhouxiaocheng/software/shogun-shogun_6.1.3/src/shogun/base/SGObject.cpp:32:10: fatal error: rxcpp/operators/rx-filter.hpp: No such file or directory
 #include <rxcpp/operators/rx-filter.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/shogun/CMakeFiles/libshogun.dir/base/SGObject.cpp.o] Error 1
make[1]: *** [src/shogun/CMakeFiles/libshogun.dir/all] Error 2
make: *** [all] Error 2

Meanwhile, I submitted an issue about it on the project's Github issue page, too. Is a fix available for either of these two problems?

Upvotes: 2

Views: 365

Answers (1)

Xiaocheng
Xiaocheng

Reputation: 21

With the contributors' help, shogun was finally compiled and installed successfully. If you have any similar trouble with shogun compiling manually, please refer to this.

Upvotes: 0

Related Questions