This repository has been archived by the owner on Aug 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathINSTALL_python_packages.sh
executable file
·76 lines (67 loc) · 2.35 KB
/
INSTALL_python_packages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /bin/bash
# Script to install Python packages for SIRF via pip.
#
# Authors: Kris Thielemans
# Copyright 2018 University College London
#
# This is software developed for the Collaborative Computational
# Project in Positron Emission Tomography and Magnetic Resonance imaging
# (http://www.ccppetmr.ac.uk/).
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#=========================================================================
prog=$0
print_usage()
{
echo "Upgrades pip and installs some Python packages needed by SIRF."
echo "Usage:"
echo " `basename $prog` --help"
echo " `basename $prog` --python 'python-command' [pip-install-options ...]"
echo 'Default Python is $SIRF_PYTHON_EXECUTABLE if it is set or python3 otherwise.'
echo "Any options (aside from --help and --python) are passed to the 'pip install' commands."
}
set -e
# give a sensible error message (note: works only in bash)
trap 'echo An error occurred in $0 at line $LINENO. Current working-dir: $PWD' ERR
# default python version
if [ -z "$SIRF_PYTHON_EXECUTABLE" ]
then
PYTHON=python3
else
PYTHON=$SIRF_PYTHON_EXECUTABLE
fi
PIPOPTIONS=""
while (( "$#" )); do
case "$1" in
--python)
PYTHON=$2
shift 2
;;
--help)
print_usage
exit 0
;;
*)
PIPOPTIONS="$PIPOPTIONS $1"
shift
;;
esac
done
$PYTHON -m pip install $PIPOPTIONS --upgrade pip wheel setuptools
$PYTHON -m pip install $PIPOPTIONS --only-binary=numpy,scipy,matplotlib numpy scipy matplotlib nose coverage docopt deprecation nibabel pytest tqdm
$PYTHON -m pip install $PIPOPTIONS jupyter spyder
$PYTHON -m pip uninstall $PIPOPTIONS -y spyder-kernels
# otherwise Jupyter uses py 2 even when you choose py3: https://github.com/jupyter/jupyter/issues/270
$PYTHON -m ipykernel install --user
# CIL
$PYTHON -m pip install $PIPOPTIONS pillow olefile