How to properly setup native ARPACK for Spark 2.2.0 - apache-spark

I am getting the following Warning when I run the PySpark job:
17/10/06 18:27:16 WARN ARPACK: Failed to load implementation
from: com.github.fommil.netlib.NativeSystemARPACK
17/10/06 18:27:16
WARN ARPACK: Failed to load implementation from:
com.github.fommil.netlib.NativeRefARPACK
My Code is
mat = RowMatrix(tf_rdd_vec.cache())
svd = mat.computeSVD(num_topics, computeU=False)
I am using Ubuntu 16.04 EC2 instance. And I have installed all following libraries into my system.
sudo apt install libarpack2 Arpack++ libatlas-base-dev liblapacke-dev libblas-dev gfortran libblas-dev liblapack-dev libnetlib-java libgfortran3 libatlas3-base libopenblas-base
I have adjusted LD_LIBRARY_PATH to point to shared lib path as following.
export LD_LIBRARY_PATH=/usr/lib/
Now when I list $LD_LIBRARY_PATH directory it shown me the following .so files
ubuntu:~$ ls $LD_LIBRARY_PATH/*.so | grep "pack\|blas"
/usr/lib/libarpack.so
/usr/lib/libblas.so
/usr/lib/libcblas.so
/usr/lib/libf77blas.so
/usr/lib/liblapack_atlas.so
/usr/lib/liblapacke.so
/usr/lib/liblapack.so
/usr/lib/libopenblasp-r0.2.18.so
/usr/lib/libopenblas.so
/usr/lib/libparpack.so
But Still I am not able to use the Native ARPACK implementation. Also I am Caching the RDD passing to matrix But it still throws Cache WARNING Any suggestion how to solve these 3 Warnings ?
I have downloaded compiled version of spark-2.2.0 from the spark download page.

After exploring I am able to remove these warnings and using native ARPACK by the following way.
The solution was to rebuild spark with -Pnetlib-lgpl argument.
Build Spark for Native Support
So following are my steps on Ubuntu 16.04
# Make sure you use the correct download link, from spark download section
wget https://d3kbcqa49mib13.cloudfront.net/spark-2.2.0.tgz
tar -xpf spark-2.2.0.tgz
cd spark-2.2.0/
./dev/make-distribution.sh --name custom-spark --pip --tgz -Psparkr -Phadoop-2.7 -Pnetlib-lgpl
When i started the first time it failed by throwing the following error
Cannot find 'R_HOME'. Please specify 'R_HOME' or make sure R is
properly installed. [ERROR] Command execution failed.
[TRUNCATED]
[INFO] BUILD FAILURE [INFO]
[INFO] Total time: 02:38 min (Wall Clock) [INFO] Finished at:
2017-10-13T21:04:11+00:00 [INFO] Final Memory: 59M/843M
[ERROR] Failed to execute goal
org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (sparkr-pkg) on project
spark-core_2.11: Command execution failed. Process exited with an
error: 1 (Exit value: 1) -> [Help 1] [ERROR]
So i installed the R language
sudo apt install r-base-core
Then i re-ran the above build command and it successfully installed.
Following are related versions when i build this release
$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
$ python --version
Python 2.7.12
$ R --version
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
$ make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu

Related

Building and installing mediapipe windows. getting error Permission denied: for opencv_world3410.dll

I am using windows 10 OS for building Mediapipe library locally.
Environment setup:
python3.10
windows 10 os
bazel version = 3.7.2
visual studio 2019
Followed the instructions from this link for building using bazel.
with some hick-ups I am able to build the specified hello world from the same above link.
With help of friend I could find building command for hands module.
command1 for building hand_tracking
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH="C://python_310//python.exe" mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
command 2 for running same.
set GLOG_logtostderr=1
.\bazel-bin\mediapipe\examples\desktop\hand_tracking\hand_tracking_cpu --calculator_graph_config_file=.\mediapipe\graphs\hand_tracking\hand_tracking_desktop_live.pbtxt
This is running just like this link: press run button on top right
I need this as a library installed in my venv.
I dont want the readily available pip install mediapipe. as it is not detecting some hand moments correctly. If I build my own on my pc, it is detecting.
I tried this command below,
(mediapipe_venv) C:\dev\mediapipe_repo\mediapipe>python setup.py install
After building and when I run this setup.py install, it is failing as below.
Warning: skipping import of repository 'pybind11' because it already exists.
WARNING: C:/dev/mediapipe_repo/mediapipe/mediapipe/framework/BUILD:54:24: in cc_library rule //mediapipe/framework:calculator_cc_proto: target '//mediapipe/framework:calculator_cc_proto' depends on deprecated target '#com_google_protobuf//:cc_wkt_protos': Only for backward compatibility. Do not use.
WARNING: C:/dev/mediapipe_repo/mediapipe/mediapipe/framework/tool/BUILD:182:24: in cc_library rule //mediapipe/framework/tool:field_data_cc_proto: target '//mediapipe/framework/tool:field_data_cc_proto' depends on deprecated target '#com_google_protobuf//:cc_wkt_protos': Only for backward compatibility. Do not use.
INFO: Analyzed target //mediapipe/python:_framework_bindings.so (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //mediapipe/python:_framework_bindings.so up-to-date:
bazel-bin/mediapipe/python/_framework_bindings.so
INFO: Elapsed time: 0.815s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
error: [Errno 13] Permission denied: 'build\\lib.win-amd64-3.10\\mediapipe\\python\\opencv_world3410.dll'
(mediapipe_venv) C:\dev\mediapipe_repo\mediapipe>
Highlighting error from above.
error: [Errno 13] Permission denied: 'build\lib.win-amd64-3.10\mediapipe\python\opencv_world3410.dll'
Please suggest me if I am following anything wrong.
I am new to building libs locally. and new for BAZEL.
The command line you're using does not have access to 'build\lib.win-amd64-3.10\mediapipe\python\opencv_world3410.dll'
Run the same command in a command line with administrative privileges.

maven and jdk8 on Alpine Linux image

This is my first time working with an Alpine linux image. Its part of a Jenkins build pipeline.
When I try to compile my maven build (which requires Java 1.8) ... it gives an error suggested there is no compiler installed.
However, I confirmed its installed ... multiple ways;
Echo the JAVA_HOME variable which returns
/usr/lib/jvm/java-1.8-openjdk
Tested to confirm the compiler is there;
by running "${JAVA_HOME}/javac -version" ... which returns;
/usr/lib/jvm/java-1.8-openjdk/bin/javac -version
javac 1.8.0_222
However, maven still points to the JRE ...
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z)
Maven home: /usr/share/java/maven-3
Java version: 1.8.0_222, vendor: IcedTea
Java home: /usr/lib/jvm/java-1.8-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.19.84-coreos", arch: "amd64", family: "unix"
I tried manually installed the JDK ... but doesn't seem to help;
apk update
apk add openjdk8
apk add maven
Any suggestions? I need Java 8 to compile this app ... and currently every attempt to do a "mvn clean install" results in a failure, as below;
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
Tried many different ideas and then eventually thought about setting the path to the compiler and amazingly, now it works!
export PATH=${PATH}:${JAVA_HOME}/bin
mvn clean install

Spark netlib-java BLAS

i am trying to troubleshoot my non-working apache spark and netlib setup and i don't know what to do next.
Here some info:
Spark 1.3.1 (but also tried 1.5.1)
Mesos Cluster with 3 Nodes
Ubuntu Trusty on every node and installed following BLAS package
$ dpkg -l | grep 'blas\|atlas\|lapack'
ii libopenblas-base 0.2.8-6ubuntu1 amd64 Optimized BLAS (linear algebra) library based on GotoBLAS2
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3 auto /usr/lib/openblas-base/libblas.so.3
I have built a sample jar for testing if netlib-java can detect this libraries, with following code:
object Main extends App {
println(com.github.fommil.netlib.BLAS.getInstance().getClass().getName())
println(com.github.fommil.netlib.LAPACK.getInstance().getClass().getName())
}
When i execute this code i get following response:
$ java -jar artifacts/BLAStest-assembly-1.0.jar
Mar 29, 2016 3:43:33 PM com.github.fommil.netlib.BLAS <clinit>
WARNING: Failed to load implementation from: com.github.fommil.netlib.NativeSystemBLAS
Mar 29, 2016 3:43:33 PM com.github.fommil.jni.JniLoader liberalLoad
INFO: successfully loaded /tmp/jniloader6790966128222263615netlib-native_ref-linux-x86_64.so
com.github.fommil.netlib.NativeRefBLAS
Mar 29, 2016 3:43:33 PM com.github.fommil.netlib.LAPACK <clinit>
WARNING: Failed to load implementation from: com.github.fommil.netlib.NativeSystemLAPACK
Mar 29, 2016 3:43:33 PM com.github.fommil.jni.JniLoader load
INFO: already loaded netlib-native_ref-linux-x86_64.so
com.github.fommil.netlib.NativeRefLAPACK
So it seems to work just fine here.
But spark can't detect the libraries. I have added this java dependency to my assembly jar
com.github.fommil.netlib:all:1.1.2
also if i try to start a spark shell with this package it doesn't work.
spark-shell --packages com.github.fommil.netlib:all:1.1.2
It looks like your netlib-java implementation is loading the NativeRefBLAS, but not the NativeSystemBLAS. This means that you're inclusion of "com.github.fommil.netlib:all" is working ok, since without it you would be using the non-native F2J implementation. The issue is that you want to use the system-provided BLAS (OpenBLAS), instead of the reference implementation that came with netlib-java. This probably just is a matter of getting the right shared libraries in a location that's visible to your spark executors.
You said that you linked libblas.so.3, but as described in the netlib-java readme, you need to also configure the libblas.so, liblapack.so, and liblapack.so.3:
sudo apt-get install libatlas3-base libopenblas-base
sudo update-alternatives --config libblas.so
sudo update-alternatives --config libblas.so.3
sudo update-alternatives --config liblapack.so
sudo update-alternatives --config liblapack.so.3

Invalid configuration i686-redhat-linux-gnu on CentOS

I launch this command to build rpm package:
#>rpmbuild --rebuild -vv vqadmin-toaster-2.3.7-1.4.1.src.rpm
I'm on CentOs 6.4 and i want to build and install qmailtoaster packets.
Only this packet get an error:
checking build system type... Invalid configuration 'i686-redhat-linux-gnu': machine 'i686-redhat-linux' not recognized
What can i do? this is first time that i'm compiling RPM packages, any ideas?
i also run into the same problem, according to qmailtoaster installation script the command suppose to be
rpmbuild --rebuild --with cnt5064 vqadmin-toaster-2.3.7-1.4.1.src.rpm
built it has the same error msg as above
and I Google around and found out
vqadmin build error
many of our programs are running automake versions that PREDATE 64-bit linux... and while most apps will build just fine (albeit less optimized), vqadmin 2.3.7 does NOT build successfully in this "unknown-linux" environment.
He offers a x86_64 rpm at the bottom

Node.js source code build giving segmentation fault on ARM

tl;dr: I tried to install node.js on my ARMv7-based Cubox running Ubuntu 12.10 (quantal). When compiling node.js from source (see "Second attempt" below), node produces a segmentation fault. What can I do here?
First attempt
First of all, I tried to install node.js via the package manager, following the instructions for Ubuntu that are given here: Installing Node.js via package manager: Ubuntu, Mint
Adding the repository mentioned there using sudo add-apt-repository ppa:chris-lea/node.js seems to work fine:
You are about to add the following PPA to your system:
Evented I/O for V8 javascript. Node's goal is to provide an easy way to build scalable network programs
More info: https://launchpad.net/~chris-lea/+archive/node.js
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmpp0owib/secring.gpg' created
gpg: keyring `/tmp/tmpp0owib/pubring.gpg' created
gpg: requesting key C7917B12 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpp0owib/trustdb.gpg: trustdb created
gpg: key C7917B12: public key "Launchpad chrislea" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
However, sudo apt-get install nodejs gives me the error:
E: Unable to locate package nodejs
I assume this is because I have an ARM-based system. As far as I can tell from the package details, the repo only contains builds for i386 and amd64. Is my assumption right?
Second attempt
So my next attempt was to install node.js from source. I used the instructions given in the following gist: Node.js and NPM in 30 seconds. Everything seems to work, including make install. But the execution of the install.sh script in the last line of the gist fails since node produces a segmentation fault. Now I wonder what I can do to properly install node.js on my machine?
In order to illustrate my problem, here is some output:
install.sh output
This is the ouput of install.sh after running make install, as described in the gist installation instructions mentioned above.
cyroxx#cubox:~/node-latest-install$ curl https://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7882 100 7882 0 0 11251 0 --:--:-- --:--:-- --:--:-- 14984
tar=/bin/tar
version:
tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
install npm#latest
fetching: http://registry.npmjs.org/npm/-/npm-1.2.21.tgz
Segmentation fault
Segmentation fault
You need node to run this program.
node --version reports: v0.10.7
Please upgrade node before continuing.
It failed
node output
cyroxx#cubox:~/node-latest-install$ node
Segmentation fault
make Debug build
Running make with BUILDTYPE=Debug produces this output:
cyroxx#cubox:~/node-latest-install$ make -C out BUILDTYPE=Debug
make: Entering directory `/home/cyroxx/node-latest-install/out'
CXX(target) /home/cyroxx/node-latest-install/out/Debug/obj.target/v8_base/deps/v8/src/arm/stub-cache-arm.o
../deps/v8/src/arm/stub-cache-arm.cc: In function 'void v8::internal::ProbeTable(v8::internal::Isolate*, v8::internal::MacroAssembler*, v8::internal::Code::Flags, v8::internal::StubCache::Table, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register)':
../deps/v8/src/arm/stub-cache-arm.cc:106:15: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
cc1plus: all warnings being treated as errors
make: *** [/home/cyroxx/node-latest-install/out/Debug/obj.target/v8_base/deps/v8/src/arm/stub-cache-arm.o] Error 1
make: Leaving directory `/home/cyroxx/node-latest-install/out'
What's wrong here? Is this a bug in the ARM implementation of V8? Maybe any compiler flags that are not (properly) set? Anything else? I am totally stuck.
I had this problem too on a few different ARM computers. Compiling without the snapshot feature worked for me. Snapshot is a V8 feature that allows node to start faster, and there seems to be a bug for ARM.
./configure --without-snapshot
make
sudo make install
http://www.armhf.com/index.php/node-js-for-the-beaglebone-black/
I had trouble building on a Samsung Chromebook XE303C12I with Crouton running Unity, even with --without-snapshot and --with-arm-float-abi=hard, so I used the precompiled binaries for Linux ARM devices.
Binaries can be found in the release directory at nodejs.org/dist/{version number}
For example, the ARM binary for v0.10.24 can be downloaded [here].(http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-arm-pi.tar.gz)
Here's a script to download and install a binary. Once you have node installed, make sure to add path/to/bin/node to your $PATH.

Resources