forked from saezlab/pypath
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac-install.sh
131 lines (115 loc) · 4.11 KB
/
mac-install.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
#
# This file is part of the `pypath` python module
#
# Copyright
# 2014-2018
# EMBL, EMBL-EBI, Uniklinik RWTH Aachen, Heidelberg University
#
# File author(s): Dénes Türei ([email protected])
# Nicolas Palacio
#
# Distributed under the GPLv3 License.
# See accompanying file LICENSE.txt or copy at
# http://www.gnu.org/licenses/gpl-3.0.html
#
# Website: http://pypath.omnipathdb.org/
#
#
# thanks for http://user.astro.columbia.edu/~williams/mac/python.html
# and https://truongtx.me/2013/11/08/macports-from-home-directory/
#
#
# This script attempts to install the pypath module with all its
# dependencies on Mac OS X systems. If everything goes well it does
# not need user intervention. This is how it works:
#
# 1: Creates local installation root under $HOME/local
# 2: Adds $HOME/local/bin to $PATH, and the local python dirs
# to $PYTHONPATH
# 3: Downloads and installs MacPorts from macports.org
# 4: Installs Python 2.7 (py27) and pycairo (py27-cairo) by port
# 5: Installs igraph and other dependencies by easy_install into the
# local python package dir
# 4: Finally does the same with pypath
#
# If you already have Python 2.7 installed, you can load all the
# newly installed packages until the local dir is in your $PYTHONPATH.
# The script attempts to add the path permanently by appending it to
# ~/.bashrc.
# If you have Python <= 2.6 installed, pypath most probably won't
# work under that version. Although as Python 2.7 is installed by
# port, that will be available on your system.
#
# This method is designed to work on most of the various OS X systems,
# and intends not to have any prerequisite.
# Depending on your specific environment, simpler, faster and more
# disk space saving methods might be possible.
echo -en "\n\n\t [!!] Please note: this is not the suggested way to install pypath.\n"\
"\t Have you considered \`mac-install-brew.sh\` or \`mac-install-conda.sh\`?\n"\
"\t If you want to use this script anyways, please open in your editor,\n"\
"\t so you know what are you doing.\n"\
"\t Now exiting.\n\n"
exit 0
PYVER=`python --version | sed 's/.*\([0-9]\.[0-9]\).*/\1/p'`
PYPATHSRC="http://pypath.omnipathdb.org/pypath-latest.tar.gz"
BUILDDIR="$HOME/build"
LOCAL="$HOME/local"
LOCALBIN="$LOCAL/bin"
LOCPYHOME="$LOCAL/lib/python2.7"
LOCPYPATH="$LOCPYHOME/site-packages"
MACPORTSVER="2.3.3"
export PYTHONPATH="$LOCPYPATH:$PYTHONPATH"
export PYTHONHOME=$LOCPYHOME
export PATH="$LOCALBIN:$PATH"
mkdir -p $LOCALBIN
mkdir -p $LOCPYPATH
mkdir -p $BUILDDIR
cd $BUILDDIR
echo -en "\n\n## paths modified by pypath installer ##\n\n" >> ~/.bash_profile
cat >> ~/.bash_profile <<- EOF
if [ -d $LOCALBIN ]; then
export PATH=$LOCALBIN:"\${PATH}"
fi
EOF
curl -L $PYPATHSRC > pypath.tar.gz
curl -L https://distfiles.macports.org/MacPorts/MacPorts-$MACPORTSVER.tar.bz2 > macports.tar.bz2
tar -vxjf macports.tar.bz2
mv MacPorts-* macports
cd macports
./configure --disable-readline --prefix=$LOCAL --with-install-user=`id -un` --with-install-group="everyone"
make
make install
cd ..
port -v selfupdate
port install curl-ca-bundle
port install gcc5
export CC="$LOCALBIN/gcc-mp-5"
port install curl
port install python27
PY27="$LOCAL/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7"
PY27DIR="$PY27/site-packages"
PY27DYN="$PY27/lib-dynload/"
DYLDLIB="$LOCAL/lib"
export PYTHONPATH="$PY27:$PY27DIR:$PY27DYN:$PYTHONPATH"
export DYLD_FALLBACK_LIBRARY_PATH="$DYLDLIB"
port install py27-cairo
port install py27-fabric
easy_install-2.7 --install-dir=$PY27DIR ipython
easy_install-2.7 --install-dir=$PY27DIR igraph
easy_install-2.7 --install-dir=$PY27DIR pandas
easy_install-2.7 --install-dir=$PY27DIR requests-cache
easy_install-2.7 --install-dir=$PY27DIR pypath.tar.gz
cat >> ~/.bash_profile <<- EOF
if [ -d $PY27DIR ]; then
export PYTHONPATH="$PY27DIR:\$PYTHONPATH"
fi
EOF
cat >> ~/.bash_profile <<- EOF
if [ -d $DYLDLIB ]; then
export DYLD_LIBRARY_PATH="$DYLDLIB"
fi
EOF
echo -en "\n\n## end: paths modified by pypath installer ##\n\n" >> ~/.bash_profile
cd $HOME
exit 0