From cde041f7024fcac948418cd3b1d87adad7f3435a Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Wed, 14 Jul 2021 19:20:12 -0600 Subject: [PATCH 1/4] install hdf5 and c-blosc on mac if using python3.9 --- setup.sh | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/setup.sh b/setup.sh index 631c31df2..ee3fee0a3 100755 --- a/setup.sh +++ b/setup.sh @@ -17,6 +17,15 @@ function check_installed_python() { exit 2 fi + which python3.9 + if [ $? -eq 0 ]; then + echo "using Python 3.9" + PYTHON=python3.9 + check_installed_pip + return + fi + + which python3.8 if [ $? -eq 0 ]; then echo "using Python 3.8" @@ -25,13 +34,6 @@ function check_installed_python() { return fi - which python3.9 - if [ $? -eq 0 ]; then - echo "using Python 3.9" - PYTHON=python3.9 - check_installed_pip - return - fi which python3.7 if [ $? -eq 0 ]; then @@ -122,6 +124,25 @@ function install_talib() { cd .. } +function install_mac_newer_python_dependencies() { + + if [ ! $(brew --prefix --installed hdf5 2>/dev/null) ] + then + echo "-------------------------" + echo "Installing hdf5" + echo "-------------------------" + brew install hdf5 + fi + + if [ ! $(brew --prefix --installed c-blosc 2>/dev/null) ] + then + echo "-------------------------" + echo "Installing c-blosc" + echo "-------------------------" + brew install c-blosc + fi +} + # Install bot MacOS function install_macos() { if [ ! -x "$(command -v brew)" ] @@ -131,6 +152,12 @@ function install_macos() { echo "-------------------------" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" fi + #Gets number after decimal in python version + version=$(egrep -o 3.\[0-9\]+ <<< $PYTHON | sed 's/3.//g' ) + + if [[ $version -ge 9 ]]; then #Checks if python version >= 3.9 + install_mac_newer_python_dependencies + fi install_talib test_and_fix_python_on_mac } From 74d7497a47b3fe9ddc40895a3b3eb8b54d97f153 Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Wed, 14 Jul 2021 19:25:51 -0600 Subject: [PATCH 2/4] Setup script tries to install python3.9 instead of 3.8 with this fix, python versions are also checked for in a loop instead of copy and pasted code --- setup.sh | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/setup.sh b/setup.sh index ee3fee0a3..1393b012a 100755 --- a/setup.sh +++ b/setup.sh @@ -17,37 +17,17 @@ function check_installed_python() { exit 2 fi - which python3.9 - if [ $? -eq 0 ]; then - echo "using Python 3.9" - PYTHON=python3.9 - check_installed_pip - return - fi + for v in {9..7}; do + PYTHON="python3.${v}" + which $PYTHON + if [ $? -eq 0 ]; then + check_installed_pip + return + fi + done - - which python3.8 - if [ $? -eq 0 ]; then - echo "using Python 3.8" - PYTHON=python3.8 - check_installed_pip - return - fi - - - which python3.7 - if [ $? -eq 0 ]; then - echo "using Python 3.7" - PYTHON=python3.7 - check_installed_pip - return - fi - - - if [ -z ${PYTHON} ]; then - echo "No usable python found. Please make sure to have python3.7 or newer installed" - exit 1 - fi + echo "No usable python found. Please make sure to have python3.7 or newer installed" + exit 1 } function updateenv() { From 65ce7c983888b43b9a871125f2f33987bd181724 Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Wed, 14 Jul 2021 20:01:43 -0600 Subject: [PATCH 3/4] Added echo python3.* line back in --- setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.sh b/setup.sh index 1393b012a..78cb499a8 100755 --- a/setup.sh +++ b/setup.sh @@ -21,6 +21,8 @@ function check_installed_python() { PYTHON="python3.${v}" which $PYTHON if [ $? -eq 0 ]; then + echo "using ${PYTHON}" + check_installed_pip return fi From 07e3f824006be83a83fa37c29cf05a72ba3b353a Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Thu, 15 Jul 2021 01:03:32 -0600 Subject: [PATCH 4/4] Changed to python3.8 installing first, removed test_and_fix_python_on_mac --- setup.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/setup.sh b/setup.sh index 78cb499a8..3bcbfc48d 100755 --- a/setup.sh +++ b/setup.sh @@ -17,7 +17,8 @@ function check_installed_python() { exit 2 fi - for v in {9..7}; do + for v in 8 9 7 + do PYTHON="python3.${v}" which $PYTHON if [ $? -eq 0 ]; then @@ -141,7 +142,6 @@ function install_macos() { install_mac_newer_python_dependencies fi install_talib - test_and_fix_python_on_mac } # Install bot Debian_ubuntu @@ -198,19 +198,6 @@ function reset() { updateenv } -function test_and_fix_python_on_mac() { - - if ! [ -x "$(command -v python3.6)" ] - then - echo "-------------------------" - echo "Fixing Python" - echo "-------------------------" - echo "Python 3.6 is not linked in your system. Fixing it..." - brew link --overwrite python - echo - fi -} - function config() { echo "-------------------------"