因學習需要安裝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后重新打開。