因学习需要安装GraphLab,但安装过程及其不顺利,在此记录整个安装全过程。
系统:Win10 Home 64
已安装:Python
使用GraphLab Create Launcher安装
首先,尝试使用官方推荐的Graphlab Create Launcher安装,下载地址:https://turi.com/download/install-graphlab-create.html
安装需有License,提前在https://turi.com/download/academic.html 申请一个academic license。
尝试了几次,都卡在70%处,失败log如下:
Successfully removed gl-env.
Creating conda environment "gl-env".
Fetching package metadata:
Solving package specifications: .
Using Anaconda Cloud api site https://api.anaconda.org
Error: Dependencies missing in current win-64 channels:
- anaconda 4.0|4.0.0* -> scipy 0.17.0 np110py27_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> numpy 1.10.4 py35_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> scipy 0.17.0 np110py34_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> scikit-learn 0.17.1 np110py27_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> numexpr 2.5 np110py35_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> scikit-learn 0.17.1 np110py34_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> pytables 3.2.2 np110py35_2 -> numexpr 2.5* -> numpy 1.11* -> blas * mkl
- anaconda 4.0|4.0.0* -> pytables 3.2.2 np110py34_2 -> numexpr 2.5* -> numpy 1.11* -> blas * mkl
- anaconda 4.0|4.0.0* -> scipy 0.17.0 np110py35_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> pytables 3.2.2 np110py27_2 -> numexpr 2.5* -> numpy 1.11* -> blas * mkl
- anaconda 4.0|4.0.0* -> pytables 3.2.2 np110py35_2 -> numexpr 2.5* -> blas * mkl
- anaconda 4.0|4.0.0* -> numpy 1.10.4 py34_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> numexpr 2.5 np110py34_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> numpy 1.10.4 py27_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> scikit-learn 0.17.1 np110py35_0 -> blas * mkl
- anaconda 4.0|4.0.0* -> pytables 3.2.2 np110py27_2 -> numexpr 2.5* -> blas * mkl
- anaconda 4.0|4.0.0* -> pytables 3.2.2 np110py34_2 -> numexpr 2.5* -> blas * mkl
- anaconda 4.0|4.0.0* -> numexpr 2.5 np110py27_0 -> blas * mkl
You can search for this package on anaconda.org with
anaconda search -t conda blas * mkl
尝试了卸载,重启,修改环境变量,用admin启动等等无用尝试后,只能采用官网上的第二种方法,Command Line安装。
使用Command Line安装GraphLab Create
在此参考了https://www.jianshu.com/p/a308f8148a18 中的安装步骤。官方也有安装步骤,但我主要是按照@Adapa提供的步骤来的。此处我并没有特意去卸载刚才安完的anaconda。
更新Anaconda
conda update conda
安装pip
conda install pip
创建环境
conda create -n gl-env python=2.7 anaconda=4.0.0
Oops,此处发生了另一个问题,提示说找不到Scripts/bokeh-script.py-server。解决方案在这里:https://github.com/bokeh/bokeh/issues/5196
@Iozzyi给出了解决方案如下:
The missing file is in there, but it's named wrong. Go to
C:\Users\<>\.conda\envs\.pkgs\bokeh-0.11.1-py27_0\info
and edit the "files" manifest file in notepad to find/replace:
Find: "bokeh-script.py-server"
Replace: "bokeh-server-script.py"
Then remove the environment in conda and create it again, it should work.
(I just tried it)
解决后再次尝试输入命令
conda create -n gl-env python=2.7 anaconda=4.0.0
成功创建环境。
激活环境。
activate gl-env
确保pip版本>=7
conda update pip
安装GraphLab Create
pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/2.1/your registered email address here/your product key here/GraphLab-Create-License.tar.gz
如果是通过刚才给的链接https://turi.com/learn/coursera/ 申请的license的话,会发一个“Personalized installation guide”链接到你的注册邮箱,上面的Email address和product key都会填好。直接copy paste就可以。
安装IPython和IPythonNotebook
conda install ipython-notebook
一切顺利的话,GraphLab Create就装好了。
测试GraphLab
annaconda安装成功的话,在开始菜单里面能找到 Anaconda Prompt (gl-env),打开python。当然,不用新开一个窗口,install完直接测试GraphLab安装情况也没有问题。
输入测试命令:
import graphlab
果然,顺利是运气,不顺利才是常态。发生错误如下:
ACTION REQUIRED: Dependencies libstdc++-6.dll and libgcc_s_seh-1.dll not found.
1. Ensure user account has write permission to C:\Users\pande\Anaconda2\envs\gl-env\lib\site-packages\graphlab
2. Run graphlab.get_dependencies() to download and install them.
3. Restart Python and import graphlab again.
By running the above function, you agree to the following licenses.
* libstdc++: https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html
* xz: http://git.tukaani.org/?p=xz.git;a=blob;f=COPYING
此问题很好解决(顺利的话),上面文字解释的很清楚。运行命令:
graphlab.get_depencencies()
成功download并安装所需要的库,重启Python。搞定。
但是,我遇到的是不顺利的情况,下载多次失败,一个几百k一个1M多到底是要闹那样!此处,参考了https://blog.csdn.net/u013569000/article/details/53886656 给出的解决方案:
找到get_depencencies()源码,即python->site-packages->graphlab->dependencies.py,找到这两个库的下载链接,手动下载之。
然后,将源代码中的下载url直接替换为已下载好的库的本地路径:
xzarchive_file = '文件路径\\xz-5.2.1-windows.zip'
dllarchive_file = '文件路径\\mingw-w64-x86_64-gcc-libs-5.1.0-1-any.pkg.tar.xz'
替换好后,再次运行命令,
graphlab.get_depencencies()
成功通过。
再次输入测试命令
import graphlab as gl print gl.__VERSION__
print 版本 2.1,这是真的成功装完了。
另外,如果安装成功还出现“no module named graphlab”。
可尝试通过Anaconda Prompt (gl-env)打开python,或者关掉所有运行的python后重新打开。