|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright (c) 2018 Jegathesan Shanmugam |
| 4 | +# Released under the MIT License (MIT) |
| 5 | +# https://github.com/nullbyte91/Simple-Sh-DataScience/blob/master/LICENSE.md |
| 6 | + |
| 7 | +# Title : fastai_v0.7_cpu.sh |
| 8 | +# Description : This script to install fast.ai cpu env on ubuntu system - Support only Nvidia GPU |
| 9 | +# author : Jegathesan Shanmugam |
| 10 | + |
| 11 | +fAnaconda2Sh="Anaconda2-4.2.0-Linux-x86_64.sh" |
| 12 | +dAnaconda2Install="$HOME/anaconda2/" |
| 13 | +python3="python3-dev" |
| 14 | +pip3="python3-pip" |
| 15 | + |
| 16 | +function installConda() |
| 17 | +{ |
| 18 | + # Install Anaconda for current user |
| 19 | + mkdir downloads |
| 20 | + cd downloads |
| 21 | + if [ ! -f ${fAnaconda2Sh} ]; |
| 22 | + then |
| 23 | + wget "https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh" -O ${fAnaconda2Sh} |
| 24 | + fi |
| 25 | + |
| 26 | + if [ -d ${dAnaconda2Install} ]; |
| 27 | + then |
| 28 | + echo "Anaconda already installed" |
| 29 | + read -r -p " Do you wanna delete and install it again[Y/n]" condaResponse |
| 30 | + if [[ "$condaResponse" =~ ^([yY][eE][sS]|[yY])+$ ]] |
| 31 | + then |
| 32 | + rm -rf ${dAnaconda2Install} |
| 33 | + bash ${fAnaconda2Sh} -b |
| 34 | + conda install -y bcolz |
| 35 | + conda upgrade -y --all |
| 36 | + fi |
| 37 | + else |
| 38 | + bash ${fAnaconda2Sh} -b |
| 39 | + echo "export PATH=\"$HOME/anaconda2/bin:\$PATH\"" >> ~/.bashrc |
| 40 | + #conda2 Env update |
| 41 | + export PATH="$HOME/anaconda2/bin:$PATH" |
| 42 | + |
| 43 | + #Proxy config if your behind the Corporate Proxy |
| 44 | + read -r -p " Are you behind the Corporate Proxy[Y/n]" proxyYes |
| 45 | + if [[ "$proxyYes" =~ ^([yY][eE][sS]|[yY])+$ ]]; |
| 46 | + then |
| 47 | + read -r -p " Type Proxy IP address[host:port]" proxyIP |
| 48 | + touch ~/.condarc |
| 49 | + echo "http: http://${proxyIP} |
| 50 | +https: https://${proxyIP} |
| 51 | +ssl_verify: False" >> ~/.condarc |
| 52 | + |
| 53 | + #Configure proxy for pip |
| 54 | + echo "export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt python" >> ~/.bashrc |
| 55 | + fi |
| 56 | + fi |
| 57 | +} |
| 58 | + |
| 59 | +function installFastaiCPU() |
| 60 | +{ |
| 61 | + mkdir -v ~/fast.ai |
| 62 | + cd ~/fast.ai |
| 63 | + git clone https://github.com/fastai/fastai.git |
| 64 | + cd fastai |
| 65 | + conda env create -f environment.yml |
| 66 | + |
| 67 | + #Activate conda env for fastai |
| 68 | + |
| 69 | + echo "List conv env: by typing conda info --envs" |
| 70 | + echo "run the below command on terminal:" |
| 71 | + echo "source activate fast_ai env" |
| 72 | + echo "Run jupyter notebook" |
| 73 | +} |
| 74 | + |
| 75 | +#MainStartsHere |
| 76 | +source ./helper_function.sh |
| 77 | +#systemBasicUpdates |
| 78 | + |
| 79 | +#Install Python3 Package |
| 80 | +installAptPackages ${python3} |
| 81 | + |
| 82 | +#Install Python3 pip package manager |
| 83 | +installAptPackages ${pip3} |
| 84 | + |
| 85 | +#Install conda |
| 86 | +installConda |
| 87 | + |
| 88 | +#Install fast.ai as per jeremy thread |
| 89 | +installFastaiCPU |
| 90 | + |
0 commit comments