Repository: climate Updated Branches: refs/heads/master da17b0e35 -> fbe566a48
CLIMATE-766 - Update easy-ocw/install-ubuntu.sh script Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/3d8dbebd Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/3d8dbebd Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/3d8dbebd Branch: refs/heads/master Commit: 3d8dbebd1bb7dd8a79e1a8876d77f453cea01993 Parents: 584ee86 Author: Ibrahim <[email protected]> Authored: Wed Mar 2 22:44:48 2016 +0530 Committer: Ibrahim <[email protected]> Committed: Thu Apr 7 21:57:22 2016 +0530 ---------------------------------------------------------------------- easy-ocw/conda-install.sh | 61 +++++++++++------- easy-ocw/install-ubuntu.sh | 137 ++++++++++------------------------------ 2 files changed, 70 insertions(+), 128 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/3d8dbebd/easy-ocw/conda-install.sh ---------------------------------------------------------------------- diff --git a/easy-ocw/conda-install.sh b/easy-ocw/conda-install.sh index 211f761..0df5377 100755 --- a/easy-ocw/conda-install.sh +++ b/easy-ocw/conda-install.sh @@ -17,29 +17,44 @@ # specific language governing permissions and limitations # under the License. -# Check if the user has conda installed. If not, we'll install Miniconda for them -command -v conda >/dev/null 2>&1 || { - echo "Couldn't find conda. Attempting to install Miniconda" - OS=`uname -s` - - if [ "${OS}" == "Darwin" ]; then - curl https://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh -o /tmp/miniconda.sh - bash /tmp/miniconda.sh - elif [ "${OS}" == "Linux" ]; then - if [ `uname -m` == "x86_64" ]; then - curl https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -o /tmp/miniconda.sh - else - curl https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86.sh -o /tmp/miniconda.sh - fi - bash /tmp/miniconda.sh - else - echo "Unable to identify your OS. Please report this to the OCW List" - echo "[email protected]" - fi +header() +{ + echo + echo $1 } -PS1='$ ' -source ~/.bashrc +task() +{ + echo " - " $1 +} + +subtask() +{ + echo " " $1 +} + +# Find absolute path to the easy-ocw directory +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR + +header "Installing dependencies via conda" +task "Reading and installing from ocw-conda-dependencies.txt (This might take some time" +conda install --file ocw-conda-dependencies.txt +subtask "done" + +# Install miscellaneous Python packages needed for OCW. Some of these +# can be installed with Conda, but since none of them have an annoying +# compiled component we just installed them with Pip. +header "Installing additional Python packages" +task "Reading and installing from ocw-pip-dependencies.txt (Please wait...)" +pip install -r ocw-pip-dependencies.txt +subtask "done" + +header "Installing ocw module" +cd .. +# Open new and install OCW +python setup.py install +subtask "finished installing ocw module" -echo "Creating conda environment from ocw environment file" -conda env create -f conda_environment.txt +header "Part 2/2 of Installation completed. Please close the terminal and start to new one for the changes to take effect" +header "For any issues with installation please contact [email protected]" http://git-wip-us.apache.org/repos/asf/climate/blob/3d8dbebd/easy-ocw/install-ubuntu.sh ---------------------------------------------------------------------- diff --git a/easy-ocw/install-ubuntu.sh b/easy-ocw/install-ubuntu.sh index ac72264..af02fd6 100755 --- a/easy-ocw/install-ubuntu.sh +++ b/easy-ocw/install-ubuntu.sh @@ -26,13 +26,8 @@ its dependencies. Flags: -h Display this help message. - -e Install and configure a virtualenv environment before installation. -q Quiet install. User prompts are removed (when possible). -It is recommended that you pass -e when running this script. If you don't, -parts of this installation will pollute your global Python install. -If you're unsure, pass -e just to be safe! - N.B. This install script has been tested against Ubuntu 12.04 and 14.04. Please report problems with this script to [email protected] ENDHELP @@ -60,10 +55,14 @@ echo " Welcome to Easy OCW" echo "---------------------------------------------------------------------------" echo -WITH_VIRTUAL_ENV=0 WITH_HOMEBREW=0 WITH_INTERACT=1 -ocw_path="${HOME}/climate" + +# Find absolute path to the easy-ocw directory +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +cd $DIR +ocw_path="$DIR/../climate" while getopts ":h :e :q" FLAG do @@ -72,9 +71,6 @@ do help exit 1 ;; - e) - WITH_VIRTUAL_ENV=1 - ;; q) WITH_INTERACT=0 ;; @@ -91,118 +87,49 @@ A number of dependencies for OCW will now be installed. Please check the wiki for a complete list of dependencies. Additionally, please read the wiki for useful installation guidelines and information that may be pertinent to your situation. All of this can be found at http://s.apache.org/3p2 - ENDINTRO -if [ $WITH_VIRTUAL_ENV != 1 ]; then -cat << VIRTUALENV_WARNING -$(tput setaf 1)<-----------------------------[WARNING!]----------------------------------->$(tput sgr 0) -It is highly recommended that you allow Easy OCW to install the dependencies -into a virtualenv environment to ensure that your global Python install is -not affected. If you're UNSURE, you should pass the -e flag -to this script. If you aren't concerned, or you want to create your own -virtualenv environment, then feel free to ignore this message. - -VIRTUALENV_WARNING -fi - -read -p "Press [Yy] to begin installation with the flag -e $(tput setaf 2)[RECOMMENDED]$(tput sgr 0) -[OR] -Press [Nn] to continue with the normal installation..." yn -case $yn in - [Yy]* ) - WITH_VIRTUAL_ENV=1 - ;; - [Nn]* ) - WITH_VIRTUAL_ENV=0 - ;; - * ) echo "Please answer yes or no.." ;; -esac - -echo -n "Please specify a full path to where your OCW download is then press [ENTER] ..." -read ocw_path fi +echo "Easy-OCW script logs" > install_log header "Checking for pip ..." command -v pip >/dev/null 2>&1 || { task "Unable to locate pip." task "Installing Pip" - sudo apt-get install python-pip >> install_log + sudo apt-get -y install python-pip >> install_log 2>&1 subtask "done" } -if [ $WITH_VIRTUAL_ENV == 1 ]; then - header "Setting up a virtualenv ..." - - # Check if virtualenv is installed. If it's not, we'll install it for the user. - command -v virtualenv >/dev/null 2>&1 || { - task "Installing virtualenv ..." - sudo apt-get install -y python-virtualenv >> install_log - subtask "done" - } - - # Create a new environment for OCW work - task "Creating a new environment ..." - virtualenv ocw >> install_log - source ocw/bin/activate - subtask "done" -fi - -# Install Continuum Analytics Anaconda Python distribution. This gives +# Install Continuum Analytics Miniconda Python distribution. This gives # almost all the dependencies that OCW needs in a single, easy to # install package. -header "Installing Anaconda Python distribution ..." +header "Installing Miniconda Python distribution ..." echo -echo "*** NOTE *** When asked to update your PATH, you should respond YES." +echo "*** NOTE *** When asked to update your PATH, you should respond YES and please do not change the default installation directory" read -p "Press [ENTER] to continue ..." -cd -task "Downloading Anaconda ..." -wget -O Anaconda-1.9.2-Linux-x86_64.sh "http://repo.continuum.io/archive/Anaconda-1.9.2-Linux-x86_64.sh" 2>> install_log -subtask "done" - -task "Installing ..." -bash Anaconda-1.9.2-Linux-x86_64.sh -export PATH="${HOME}/anaconda/bin:$PATH" -subtask "done" - -# Install Basemap. Conda cannot be used for this install since -# it fails to analyse the dependencies (at the time of writing). This -# will install it manually. At some point, this should be replaced with -# 'conda install basemap' once it is working again! -header "Handling Basemap install ..." - -cd -task "Downloading basemap ..." -wget -O basemap-1.0.7.tar.gz "http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.7/basemap-1.0.7.tar.gz/download" 2>> install_log -tar xzf basemap-1.0.7.tar.gz >> install_log -subtask "done" - -# Install GEOS -task "Installing GEOS dependency ..." -cd basemap-1.0.7/geos-3.3.3 -export GEOS_DIR=/usr/local -./configure --prefix=$GEOS_DIR >> install_log -sudo make >> install_log -sudo make install >> install_log -subtask "done" - -# Install basemap -task "Installing Basemap ..." -cd .. -python setup.py install >> install_log -subtask "done" - -cd +MACHINE_TYPE=`uname -m` +if [ ${MACHINE_TYPE} == 'x86_64' ]; then + link="https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh" +else + link="https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86.sh" +fi -# Install miscellaneous Python packages needed for OCW. Some of these -# can be installed with Conda, but since none of them have an annoying -# compiled component we just installed them with Pip. -header "Installing additional Python packages" -pip install -r ocw-pip-dependencies.txt >> install_log +header "Checking for conda ..." +command -v conda >/dev/null 2>&1 || { + task "Unable to locate conda." + if ! [ -f Miniconda-latest-linux.sh ]; then + task "Downloading Miniconda ..." + wget -O Miniconda-latest-linux.sh $link >> install_log 2>&1 + subtask "done" + fi + task "Installing ..." + bash Miniconda-latest-linux.sh + subtask "done" +} -# Ensure that the climate code is included in the Python Path -header "Updating PYTHONPATH with ocw executables ..." -echo "export PYTHONPATH=${ocw_path}:${ocw_path}/ocw" >> ${HOME}/.bashrc +task "Installing python-dev" +sudo apt-get -y install python-dev >> install_log 2>&1 subtask "done" +header "Part 1/2 of installation completed. Please start a new terminal and execute conda-install.sh script."
