From 0161b10f64b6fdc60f6a58c9257e5395af98339f Mon Sep 17 00:00:00 2001 From: yanghaoran Date: Wed, 29 Dec 2021 19:08:10 +0800 Subject: [PATCH] a script for euleros environments to prepare MindSpore runtime environment --- scripts/install/euleros-ascend-pip.sh | 52 +++++++++++++++++++++++++++ scripts/install/ubuntu-pip.sh | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 scripts/install/euleros-ascend-pip.sh diff --git a/scripts/install/euleros-ascend-pip.sh b/scripts/install/euleros-ascend-pip.sh new file mode 100644 index 00000000000..027296e03ae --- /dev/null +++ b/scripts/install/euleros-ascend-pip.sh @@ -0,0 +1,52 @@ +#!/bin/bash +set -ex + +# sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.bak 单独执行 +PYTHON_VERSION=${PYTHON_VERSION:-3.7.5} +MINDSPORE_VERSION=${MINDSPORE_VERSION:-1.5.0} +ARCH=`uname -m` + +if [[ "${PYTHON_VERSION}" == "3.7.5" ]]; then + VERSION="${MINDSPORE_VERSION}-cp37-cp37m" +else + VERSION="${MINDSPORE_VERSION}-cp39-cp39" +fi + +#use huaweicloud mirror in China +repo_path=/etc/yum.repos.d/euleros.repo +cat > ${repo_path} << END +[base] +name=EulerOS-2.0SP8 base +baseurl=http://repo.huaweicloud.com/euler/2.8/os/${ARCH} +enabled=1 +gpgcheck=1 +gpgkey=http://repo.huaweicloud.com/euler/2.8/os/RPM-GPG-KEY-EulerOS +END +cat ${repo_path} + +yum clean all +yum makecache + +yum install gmp-devel +yum install + +# install python 3.7 +cd /tmp +wget https://github.com/python/cpython/archive/v3.7.5.tar.gz +tar -xvf v3.7.5.tar.gz +cd /tmp/cpython-3.7.5 +mkdir -p ${PYTHON_ROOT_PATH} +./configure --prefix=${PYTHON_ROOT_PATH} --enable-shared +make -j4 +make install -j4 +rm -f /usr/local/bin/python +rm -f /usr/local/bin/pip +rm -f /usr/local/lib/libpython3.7m.so.1.0 +ln -s ${PYTHON_ROOT_PATH}/bin/python3.7 /usr/local/bin/python +ln -s ${PYTHON_ROOT_PATH}/bin/pip3.7 /usr/local/bin/pip +ln -s ${PYTHON_ROOT_PATH}/lib/libpython3.7m.so.1.0 /usr/local/lib/libpython3.7m.so.1.0 +ldconfig +rm -rf /tmp/cpython-3.7.5 +rm -f /tmp/v3.7.5.tar.gz + +pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/${MINDSPORE_VERSION}/MindSpore/ascend/${ARCH}/mindspore-${VERSION}-linux_${ARCH}.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple \ No newline at end of file diff --git a/scripts/install/ubuntu-pip.sh b/scripts/install/ubuntu-pip.sh index 06fdb041614..f68938e2540 100644 --- a/scripts/install/ubuntu-pip.sh +++ b/scripts/install/ubuntu-pip.sh @@ -9,7 +9,7 @@ ARCH=`uname -m` if [[ "${PYTHON_VERSION}" == "3.7.5" ]]; then VERSION="${MINDSPORE_VERSION}-cp37-cp37m" else -VERSION="${MINDSPORE_VERSION}-cp39-cp39m" +VERSION="${MINDSPORE_VERSION}-cp39-cp39" fi