-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·59 lines (50 loc) · 2.11 KB
/
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
#!/bin/bash
echo "Installing morphoclass"
pip install . -c constraints.txt
echo "Checking the PyTorch version"
SED=$(which gsed || which sed)
TORCH_VERSION=$(pip freeze | grep torch== | $SED -re "s/torch==([^+]+).*/\1/")
if [ -z "$TORCH_VERSION" ]
then
echo ">> PyTorch should have been installed, but no installation of it was found"
echo ">> Installation failed"
exit 1
fi
echo "Checking the CUDA version"
OS_NAME=$(uname -s)
if [ "$OS_NAME" == "Linux" ]
then
# check if cuda is available in these 3 locations
if [ ! -d "/usr/local/cuda/lib64" ] && [ ! -d "/usr/lib/cuda/lib64" ] && [ ! -d "/usr/lib/nvidia-cuda-toolkit" ]
then
echo ">> PyTorch was installed with CUDA support, but no CUDA toolkit libraries were found."
echo ">> Re-installing the CPU version of PyTorch"
echo ">> PyTorch version: $TORCH_VERSION"
pip install "torch==${TORCH_VERSION}+cpu" -f https://download.pytorch.org/whl/torch_stable.html
fi
fi
echo "Installing PyTorch-Geometric"
CUDA_VERSION=$(python -c "import torch; print(torch.version.cuda or '')")
if [ -z "$CUDA_VERSION" ]
then
CUDA="cpu"
else
CUDA="cu${CUDA_VERSION/./}"
fi
FIND_LINKS="https://pytorch-geometric.com/whl/torch-${TORCH_VERSION}+${CUDA}.html"
echo "$FIND_LINKS"
# Note: installing without pinning versions. Maybe should pin at some point.
# Indexes like devpi take precedence over find-links. But the currently
# configured index might have some versions of the given package too. If the
# index only has the source distribution then instead of downloading the wheel
# from the find-links URL pip will download the source distribution from
# the index and try to build a wheel form it. To avoid this and to force lookup
# in the find-links URL disable the index completely.
pip install torch-scatter --no-index -f "$FIND_LINKS"
pip install torch-sparse --no-index -f "$FIND_LINKS"
pip install torch-cluster --no-index -f "$FIND_LINKS"
pip install torch-spline-conv --no-index -f "$FIND_LINKS"
pip install "torch-geometric<2"
echo "Morphoclass and PyTorch-related packages that were installed are:"
pip list | grep -E "^torch[=|-]|^morphoclass" --color=never
echo "Finished"