[mlpack] issue with mlpack Python bindings on Mac OsX

Frodo Jedi frodojedi.mailinglist at gmail.com
Thu Dec 13 05:26:24 EST 2018


Hi Ryan,
many thanks for your quick reply.

When running "make python"  I get the following error:

In file included from
/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1816:
/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2:
warning: "Using deprecated NumPy
      API, disable it by "          "#defining NPY_NO_DEPRECATED_API
NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
 ^
1 warning generated.
clang++ -bundle -undefined dynamic_lookup
build/temp.macosx-10.12-x86_64-2.7/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/src/mlpack/bindings/python/mlpack/softmax_regression.o
-L/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/lib/
-L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib
-lmlpack -lboost_serialization -o
build/lib.macosx-10.12-x86_64-2.7/mlpack/softmax_regression.so
[100%] Built target build_pyx_softmax_regression
running build_ext
cythoning
/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/src/mlpack/bindings/python/mlpack/arma_numpy.pyx
to
/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/src/mlpack/bindings/python/mlpack/arma_numpy.cpp
building 'mlpack.arma_numpy' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv
-O3 -Wall -Wstrict-prototypes
-I/usr/local/lib/python2.7/site-packages/numpy/core/include
-I/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/src/mlpack/bindings/python/
-I/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/src
-I/usr/local/include -I/usr/local/include
-I/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/src/mlpack/..
-I/usr/local/include -I/usr/local/opt/openssl/include
-I/usr/local/opt/sqlite/include
-I/usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/include/python2.7
-c
/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/src/mlpack/bindings/python/mlpack/arma_numpy.cpp
-o
build/temp.macosx-10.12-x86_64-2.7/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/src/mlpack/bindings/python/mlpack/arma_numpy.o
-DBINDING_TYPE=BINDING_TYPE_PYX -std=c++11 -O3 -Wno-unknown-pragmas
error: unable to open output file

'build/temp.macosx-10.12-x86_64-2.7/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build/src/mlpack/bindings/python/mlpack/arma_numpy.o':
      'Operation not permitted'
1 error generated.
error: command 'clang' failed with exit status 1
make[3]: *** [python] Error 1
make[2]: *** [src/mlpack/bindings/python/CMakeFiles/python.dir/all] Error 2
make[1]: *** [src/mlpack/bindings/python/CMakeFiles/python.dir/rule] Error 2
make: *** [python] Error 2


It seems to me that there is an issue with numpy, and as a matter of fact
during the whole building process several warnings about the deprecated
numpy API were risen. I don't understand as my numpy version is updated
(version: 1.14.2)

Notably, there are some issues when running cmake whit a completely clean
(i.e. new) build directory:

-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS
OpenMP_CXX_LIB_NAMES)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)


This is the full output of cmake:

-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- cotire 1.7.10 loaded.
-- Found Armadillo: /usr/local/lib/libarmadillo.dylib (found suitable
version "9.100.5", minimum required is "6.500.0")
-- Armadillo libraries: /usr/local/lib/libarmadillo.dylib
-- Boost version: 1.68.0
-- Found the following Boost libraries:
--   program_options
--   unit_test_framework
--   serialization
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS
OpenMP_CXX_LIB_NAMES)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
-- Found Git: /usr/local/bin/git (found version "2.19.0")
-- Regenerating arma_config.hpp.
-- Found PythonInterp: /usr/local/bin/python (found version "2.7.15")
-- Found Python: /usr/local/bin/python
-- Found PY_distutils: /usr/local/Cellar/python at 2
/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils
-- Found PY_Cython: /usr/local/lib/python2.7/site-packages/Cython
-- Found PY_numpy: /usr/local/lib/python2.7/site-packages/numpy
-- Found PY_pandas: /usr/local/lib/python2.7/site-packages/pandas
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- CXX target mlpack cotired.
-- CXX target mlpack_test cotired.
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.14") found
components:  doxygen missing components:  dot
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Configuring done
-- Generating done
-- Build files have been written to:
/Users/frodo/Documents/Machine_learning/mlpack-3.0.4/build



What do you suggest should I do? Any flag for cmake you reccommend me to
use?

Cheers

FJ







On Thu, Dec 13, 2018 at 3:01 AM Ryan Curtin <ryan at ratml.org> wrote:

> On Wed, Dec 12, 2018 at 10:31:34PM +0000, Frodo Jedi wrote:
> > Dear list members,
> > I am unable to properly install the python bindings, despite I correctly
> > built mlpack from source without any error and warning. I am on a Mac OsX
> > 10.12.6 and all the dependencies have been installed with the latest
> > available version. I am also using the latest version of Cmake.
>
> Hey there,
>
> Thanks for getting in touch.  Let's see if we can work out the issues.
> :)
>
> > Looking at this thread, where the same issue was reported,
> > https://github.com/mlpack/mlpack/issues/1416 , I get that mlpack should
> be
> > installed in
> > /usr/local/lib/pythonX.Y/site-packages/ However it is not present.
>
> I wonder if this is a result of the Python bindings not being built.
> There are a couple things to try which will tell us something.
>
>  1. Try running 'make python' from the build directory.  If make
>     complains that the target is unknown, then CMake did not properly
>     find everything it needs to build the mlpack bindings.  Try running
>     'cmake ..' in a new, clean build directory and it will give some
>     more information (if you like, add the information to an email and
>     it can help debug).
>
>  2. If 'make python' does work, then it is not being installed for a
>     strange reason.  Paste the output of 'make install', and deep inside
>     that there will be a section where it installs the Python bindings,
>     and there should be information there.
>
> If neither of those work, we can try and come up with some more things
> to try, but I strongly suspect either (or both) of those will give us
> the information we need to figure out the Python bindings.
>
> > Also, I signal that I get the following errors when running the test:
>
> Thanks for running the tests.  It's always helpful to see what does and
> doesn't work for people.  But one issue is that mlpack tests are
> randomized, so it is possible to be unlucky.  We do our best to keep the
> failure probabilities very low, but sometimes we fail at it.  Actually
> as I write this, I am also working on a PR to reduce the failure
> probabilities of some tests.
>
> >
> /Users/frodo/Documents/Machine_learning/mlpack-3.0.4/src/mlpack/tests/logistic_regression_test.cpp:784:
> > fatal error: in
> "LogisticRegressionTest/LogisticRegressionSparseLBFGSTest":
> > difference{1.04095e-06} between lr.Parameters()[i]{0.057823485257429592}
> > and lrSparse.Parameters()[i]{0.057823425065859017} exceeds 0.0001%
>
> This is just unlucky, I'll increase the tolerance a bit.
>
> >
> /Users/frodo/Documents/Machine_learning/mlpack-3.0.4/src/mlpack/tests/lrsdp_test.cpp:270:
> > fatal error: in "LRSDPTest/GaussianMatrixSensingSDP":
> > difference{0.00055936} between measurement{0.00023854628409627696} and
> > b(i){0.00023841292538047745} exceeds 0.05%
>
> Same here, 0.0559% difference does not indicate to me that something is
> wrong.
>
> > error: eig_sym(): decomposition failed
> > unknown location:0: fatal error: in
> > "SdpPrimalDualTest/SmallLovaszThetaSdp": std::runtime_error: eig_sym():
> > decomposition failed
> >
> /Users/frodo/Documents/Machine_learning/mlpack-3.0.4/src/mlpack/tests/sdp_primal_dual_test.cpp:278:
> > last checkpoint: "SmallLovaszThetaSdp" test entry
> > ** On entry to DLASCL, parameter number  4 had an illegal value
> > ** On entry to DLASCL, parameter number  5 had an illegal value
> >
> /Users/frodo/Documents/Machine_learning/mlpack-3.0.4/src/mlpack/tests/main_tests/preprocess_imputer_test.cpp:76:
> > fatal error: in
> "PreprocessImputerMainTest/PreprocessImputerDimensionTest":
> > critical check outputData.n_cols == inputSize has failed [0 != 67]
> >
> /Users/frodo/Documents/Machine_learning/mlpack-3.0.4/src/mlpack/tests/main_tests/preprocess_imputer_test.cpp:143:
> > fatal error: in
> > "PreprocessImputerMainTest/PreprocessImputerListwiseDimensionTest":
> > critical check outputData.n_cols + countNaN == inputSize has failed [26
> !=
> > 67]
>
> But these three are very strange to me and I have not seen them before.
> They do not look like random failures.  I saw some similar errors in
> this issue:
>
> https://github.com/mlpack/mlpack/issues/1560
>
> However I do not have an OS X machine, so I am not able to reproduce any
> of these issues.  Maybe if someone is able to solve #1560, it could also
> solve your problem.  However, if you are not directly planning on using
> the imputer for preprocessing or the SDP solver functionality, I think
> there should be no problem on your system.
>
> > Finally, I signl that pip install mlpack/mlpack3 does not work.
>
> Right, this only works on 'manylinux' machines due to the challenges of
> packaging Python software that depends on C++ libraries.  It could be
> possible to make it work for OS X, but personally I do not have any OS X
> system so I can't test it.
>
> I hope this information helps!
>
> Thanks,
>
> Ryan
>
> --
> Ryan Curtin    | "He takes such wonderful pictures with
> ryan at ratml.org | his paws."  - Radio man
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20181213/ccce21a3/attachment-0001.html>


More information about the mlpack mailing list