@@ -42,47 +42,53 @@ TF_TYPE="cpu"
42
42
43
43
44
44
function install_protobuf3.4.0() {
45
- # Install Relevant tooling
46
- # Remove any old versions of protobuf
47
- DISTRIB=$1 # ubuntu/fedora
48
- if [ " $DISTRIB " == " ubuntu" ]
49
- then
50
- sudo apt-get --yes --force-yes remove --purge libprotobuf-dev protobuf-compiler
51
- elif [ " $DISTRIB " == " fedora" ]
52
- then
53
- sudo dnf -q remove -y protobuf protobuf-devel protobuf-compiler
54
- else
55
- echo " Only Ubuntu and Fedora is supported currently!"
56
- return 0
57
- fi
58
- wget -O protobuf-cpp-3.4.0.tar.gz https://github.com/google/protobuf/releases/download/v3.4.0/protobuf-cpp-3.4.0.tar.gz
59
- tar -xzf protobuf-cpp-3.4.0.tar.gz
60
- cd protobuf-3.4.0
61
- ./autogen.sh && ./configure && make -j4 && sudo make install && sudo ldconfig
62
- cd ..
63
- # Cleanup
64
- rm -rf protobuf-3.4.0 protobuf-cpp-3.4.0.tar.gz
45
+ # Install Relevant tooling
46
+ # Remove any old versions of protobuf
47
+ DISTRIB=$1 # ubuntu/fedora
48
+ if [ " $DISTRIB " == " ubuntu" ]; then
49
+ sudo apt-get --yes --force-yes remove --purge libprotobuf-dev protobuf-compiler
50
+ elif [ " $DISTRIB " == " fedora" ]; then
51
+ sudo dnf -q remove -y protobuf protobuf-devel protobuf-compiler
52
+ else
53
+ echo " Only Ubuntu and Fedora is supported currently!"
54
+ return 0
55
+ fi
56
+ if /usr/local/bin/protoc --version == " libprotoc 3.4.0" ; then
57
+ echo " protobuf-3.4.0 already installed"
58
+ return
59
+ fi
60
+ wget -O protobuf-cpp-3.4.0.tar.gz https://github.com/google/protobuf/releases/download/v3.4.0/protobuf-cpp-3.4.0.tar.gz
61
+ tar -xzf protobuf-cpp-3.4.0.tar.gz
62
+ cd protobuf-3.4.0
63
+ ./autogen.sh && ./configure && make -j4 && sudo make install && sudo ldconfig
64
+ cd ..
65
+ # Cleanup
66
+ rm -rf protobuf-3.4.0 protobuf-cpp-3.4.0.tar.gz
65
67
}
66
68
67
69
# Utility function for installing tensorflow components of python/C++
68
70
function install_tf() {
69
- TFCApiFile=$1
70
- TF_VERSION=$2
71
- LinkerConfigCmd=$3
72
- TARGET_DIRECTORY=" /usr/local"
73
- # Install Tensorflow Python Binary
74
- sudo -E pip3 install --upgrade pip
75
- # Related issue: https://github.com/pypa/pip/issues/3165
76
- sudo -E pip3 install tensorflow==${TF_VERSION} --upgrade --ignore-installed six
71
+ if pip show -q tensorflow && [ -d /usr/local/include/tensorflow/c ]; then
72
+ echo " tensorflow already installed"
73
+ return
74
+ fi
75
+ TFCApiFile=$1
76
+ TF_VERSION=$2
77
+ LinkerConfigCmd=$3
78
+ TARGET_DIRECTORY=" /usr/local"
79
+ # Install Tensorflow Python Binary
80
+ sudo -E pip3 install --upgrade pip
81
+ # Related issue: https://github.com/pypa/pip/issues/3165
82
+ sudo -E pip3 install tensorflow==${TF_VERSION} --upgrade --ignore-installed six
77
83
78
- # Install C-API
79
- TFCApiURL=" https://storage.googleapis.com/tensorflow/libtensorflow/${TFCApiFile} "
80
- wget -O $TFCApiFile $TFCApiURL
81
- sudo tar -C $TARGET_DIRECTORY -xzf $TFCApiFile || true
82
- # Configure the Linker
83
- eval $LinkerConfigCmd
84
- # Cleanup
85
- rm -rf ${TFCApiFile}
84
+ # Install C-API
85
+ TFCApiURL=" https://storage.googleapis.com/tensorflow/libtensorflow/${TFCApiFile} "
86
+ wget -O $TFCApiFile $TFCApiURL
87
+ sudo tar -C $TARGET_DIRECTORY -xzf $TFCApiFile || true
88
+ # Configure the Linker
89
+ eval $LinkerConfigCmd
90
+ # Cleanup
91
+ rm -rf ${TFCApiFile}
86
92
}
87
93
88
94
# # ------------------------------------------------
0 commit comments