Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EFL Load Command Error for sklearn lambda build with python3

I did sklearn build for python3 to use in aws lambda. with

yum -qye 0 update
yum -qye 0 groupinstall development
yum -y install python-devel
yum -qye 0 install libxml2-devel libxslt-devel libjpeg-devel zlib-devel libpng-devel openssl-devel sqlite-devel
export HOME_DIR=`pwd`

yum -y install wget
wget --no-verbose https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar -xzf Python-3.6.1.tgz
cd Python-3.6.1
./configure --with-bz2 --enable-optimizations
make --silent -j2
make altinstall --silent
cd $HOME_DIR   # cd /outputs
rm Python-3.6.1.tgz
rm -rf Python-3.6.1/
ln -s /usr/local/bin/python3.6 /usr/bin/python3
python3 -m pip install virtualenv

python3 -m pip install  --upgrade pip wheel
python3 -m pip install --use-wheel --no-binary numpy numpy
python3 -m pip install --use-wheel --no-binary scipy scipy
python3 -m pip install --use-wheel sklearn
python3 -m pip install joblib


cd $HOME_DIR
virtualenv -p /usr/bin/python3 /Vsk
source  /Vsk/bin/activate
/Vsk/bin/pip3.6 install 
/Vsk/bin/pip3.6 install --use-wheel --no-binary scipy scipy
find /Vsk/lib/python3.6/site-packages/ -name "*.so" | xargs strip
echo "venv stripped size $(du -sh $Vsk | cut -f1)"
pushd /Vsk/lib/python3.6/site-packages/ && zip -r -9 -q /outputs/SkZipNew2.zip * ; popd
echo "site-packages compressed size $(du -sh /outputs/SkZipNew2.zip | cut -f1)"

But When I use this package with my sklearn generated tree in aws-lambda. I got this error Unable to import module 'lambda_handler': /var/task/scipy/sparse/linalg/isolve/_iterative.cpython-36m-x86_64-linux-gnu.so: ELF load command address/offset not properly aligned Any idea what am I doing wrong? Thanks

like image 609
Ch HaXam Avatar asked Sep 03 '26 06:09

Ch HaXam


1 Answers

I had a similar issue when installing the latest scipy with sklearn-learn. The way I fixed it is to install scipy==0.19.0.

like image 119
Vivant SHEN Avatar answered Sep 05 '26 07:09

Vivant SHEN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!