阿里云Graph-Learn框架安装指南
1.GL框架简述
Graph-Learn(GL,原AliGraph) 是面向大规模图神经网络的研发和应用而设计的一款分布式框架, 它从实际问题出发,提炼和抽象了一套适合于当下图神经网络模型的编程范式, 并已经成功应用在阿里巴巴内部的诸如搜索推荐、网络安全、知识图谱等众多场景。
@article{zhu2019aligraph,
title={AliGraph: a comprehensive graph neural network platform},
author={Zhu, Rong and Zhao, Kun and Yang, Hongxia and Lin, Wei and Zhou, Chang and Ai, Baole and Li, Yong and Zhou, Jingren},
journal={Proceedings of the VLDB Endowment},
volume={12},
number={12},
pages={2094–2105},
year={2019},
publisher={VLDB Endowment}
}
2.环境要求
Ubuntu 16.04,python2.7,g++5.4.0。
python还需要tensorflow1.12.0,scipy等第三方库。
按步骤安装过程中,常出现环境中缺少执行命令必要的依赖的问题,故从安装过程中总结出了环境配置的.sh脚本,用来自动检测并配置GL安装所需的依赖。
3.如何使用脚本并执行
在Ubuntu终端下,首先进入用户目录:
cd ~
下载脚本:
git clone https://github.com/OvO-Ma/GL_init.git
将执行脚本移动到用户目录并执行:
sudo mv GL_init.sh ~
cd ~
./GL_init.sh
4.附录脚本原文
#!/bin/bash
#GL_init.sh
sudo apt-get install vim
echo '修改hosts配置'
sudo chmod -R 777 /etc/hosts
echo '192.30.255.112 github.com git
185.31.16.184 github.global.ssl.fastly.net'>>/etc/hosts
sudo /etc/init.d/networking restart
echo '检查python版本'
sudo python GL_init/check_pyversion.py
echo '安装必需的python第三方库'
sudo apt-get install python-pip
pip install --upgrade pip
sudo pip install enum
sudo pip install scipy
sudo pip install tensorflow==1.12
echo '安装git'
sudo apt-get purge runit
sudo apt-get purge git-all
sudo apt-get purge git
sudo apt-get autoremove
sudo apt update
sudo apt install git
sudo apt-get install autoconf automake libtool cmake python-numpy
echo '安装GL.git'
git clone https://github.com/alibaba/graph-learn.git
#!/bin/bash/python
#check_pyversion.py
import sys
import re
import os
def check_py():
py_v = sys.version[0:3]
if (py_v == '2.7'):
print('current python version is 2.7')
else:
versions = os.popen('sudo update-alternatives --list python','r')
versions = (versions.read()).split('\n')
versions.pop()
#print(versions)
vs_list = []
for vs in versions:
vs_list.append((re.findall(r'/usr/bin/python(.*$)',vs))[0])
if '2.7' in vs_list:
py_v2 = sys.version[0:3]
os.system('sudo ln -s -f /usr/bin/python2.7 /usr/bin/python')
else:
print('NO PYTHON 2.7 IN SYSTEM\nSTART INSTALL PYTHON 2.7')
os.system('sudo apt-get install python2.7')
os.system('sudo apt update')
os.system('sudo apt install python-pip')
os.system('pip install --upgrade pip')
os.system('sudo ln -s -f /usr/bin/python2.7 /usr/bin/python')
print('INSTALLING DONE')
check_py()