Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Update install-mxnet-osx-python.sh #8825

Merged
merged 6 commits into from
Jan 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 80 additions & 23 deletions setup-utils/install-mxnet-osx-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@

#set -ex

export MXNET_GITPATH="https://github.com/dmlc/mxnet.git"
export MXNET_GITPATH="https://github.com/apache/incubator-mxnet"


if [ -z ${MXNET_TAG} ];
then
#
# TODO: Change this to latest tag
# to avoid updating this value for every release
#
export MXNET_TAG="1.0.0"
export MXNET_BRANCH_TAG=""
else
export MXNET_BRANCH_TAG="--branch $MXNET_TAG"
fi

export TARIKH=`/bin/date +%Y-%m-%d-%H:%M:%S`
Expand Down Expand Up @@ -79,7 +79,7 @@ print_intro_msg() {
echo "This script has been tested on: MacOS El Capitan (10.11) and Sierra (10.12)"
echo " "
echo "If you face any problems with this script, please let us know at:"
echo " https://stackoverflow.com/questions/tagged/mxnet"
echo " https://discuss.mxnet.io/"
echo " "
echo "Typical run-time for this script is around 10 minutes."
echo "If your environment has never been setup for development (e.g. gcc), "
Expand All @@ -89,8 +89,42 @@ print_intro_msg() {
echo "Your macOS version is: $MACOS_VERSION"
echo " "
echo $LINE
read -p "Do you want to continue? (y/n): " response
echo " "
sleep ${SLEEP_TIME}
while true; do
case $response in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
echo " "
echo " "
echo "MXNET GIT Path = ${MXNET_GITPATH}"
echo "MXNET Tag = ${MXNET_TAG}"
echo "You can set \$MXNET_TAG to the appropriate github repo tag"
echo "If not set, the default value used is the latest version on master"
read -p "Do you want to get a list of available tags? (y/n): " response
while true; do
case $response in
[Yy]* )
echo "Available tags are:"
git ls-remote --tags ${MXNET_GITPATH} | sed 's/refs\/tags\///' | grep -v v | grep -v 201 \
| grep -v "{}" | awk '{ print " ", $2 }';
break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
read -p "Do you want to continue? (y/n): " response
echo " "
while true; do
case $response in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
} # print_intro_msg()

# wrapper routine to stop the script if the command invoked returns error
Expand Down Expand Up @@ -348,6 +382,39 @@ install_dep_pip_for_mxnet() {
echo " "
} # install_dep_pip_for_mxnet()

# check if mxnet is already installed through other means
chk_mxnet_installed() {
mxnet_installed=`pip list --format=columns | grep mxnet`
if [ "$mxnet_installed" != "" ]
then
mxnet_version=`echo $mxnet_installed | awk '{print $2}'`
echo "MXNet ${mxnet_version} is already installed."
echo "This installation might interfere with current installation attempt."
read -p "Do you want to remove installed version? (y/n): " response
while true; do
case $response in
[Yy]* )
sudo -H pip uninstall mxnet
chk_mxnet_installed
break
;;
[Nn]* )
while true; do
read -p "Do you want to continue? (y/n): " response1
echo " "
case $response1 in
[Yy]* ) break 2;; # break out of nested loop
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
;;
* ) echo "Please answer yes or no.";;
esac
done
fi
} # chk_mxnet

download_mxnet() {
echo " "
echo "BEGIN: Download MXNet"
Expand All @@ -360,21 +427,11 @@ download_mxnet() {
sleep ${SLEEP_TIME}
fi

echo " "
echo "MXNET GIT Path = ${MXNET_GITPATH}"
#echo "MXNET Tag = ${MXNET_TAG}"
#echo "You can set \$MXNET_TAG to the appropriate github repo tag"
#echo "If not set, the default value used is the latest release"
echo " "
sleep ${SLEEP_TIME}

chkret git clone ${MXNET_GITPATH} ${MXNET_HOME} --recursive

chkret git clone ${MXNET_BRANCH_TAG} ${MXNET_GITPATH}.git ${MXNET_HOME} --recursive
sleep ${SLEEP_TIME}
cd ${MXNET_HOME}
echo " "
#echo "Checkout tag = ${MXNET_TAG}"
#chkret git checkout ${MXNET_TAG}
#echo " "
sleep ${SLEEP_TIME}
echo "END: Download MXNet"
echo $LINE
Expand Down Expand Up @@ -465,13 +522,12 @@ END
echo "FYI : You can fine-tune MXNet run-time behavior using environment variables described at:"
echo " http://mxnet.io/how_to/env_var.html"
echo " "
echo "NEXT: Try the MNIST tutorial at: http://mxnet.io/tutorials/python/mnist.html"
echo " Try other tutorials at : http://mxnet.io/tutorials"
echo "NEXT: Try the tutorials at: http://mxnet.io/tutorials"
echo " "
echo $LINE
echo " "
rm -f mxnet_test.log mxnet_test.expected
exit 0
return 0
else
echo " "
echo "ERROR: Following files differ: mxnet_test.log mxnet_test.expected"
Expand All @@ -488,6 +544,7 @@ main() {
chk_mac_vers
install_mac_pkg_manager
install_dep_pip_for_mxnet
chk_mxnet_installed
download_mxnet
compile_mxnet
install_mxnet_python
Expand Down