调试经验——GraphLab Create的安装

万事开头难,为了导入GraphLab包,花了我两个多小时。

问题描述:

在Jupyter Notebook 中执行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_dependencies()命令,结果又出现以下错误:

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-2-c9bb182d1ed0> in <module>()----> 1graphlab.get_dependencies()C:\Users\pande\Anaconda2\envs\gl-env\lib\site-packages\graphlab\dependencies.pyc in get_dependencies() 3132 print('Downloading xz.')---> 33(xzarchive_file, xzheaders)= urllib.urlretrieve('http://tukaani.org/xz/xz-5.2.1-windows.zip') 34 xzarchive_dir = tempfile.mkdtemp() 35print('Extracting xz.')C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc in urlretrieve(url, filename, reporthook, data, context) 96else: 97 opener= _urlopener---> 98return opener.retrieve(url, filename, reporthook, data) 99 def urlcleanup(): 100if _urlopener:C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc inretrieve(self, url, filename, reporthook, data) 243except IOError: 244pass--> 245fp = self.open(url, data) 246try: 247 headers= fp.info()C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc inopen(self, fullurl, data) 211try: 212if data is None:--> 213return getattr(self, name)(url) 214 else: 215return getattr(self, name)(url, data)C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc in open_http(self, url, data) 362else: 363if data is None:--> 364return self.http_error(url, fp, errcode, errmsg, headers) 365else: 366return self.http_error(url, fp, errcode, errmsg, headers, data)C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc inhttp_error(self, url, fp, errcode, errmsg, headers, data) 375 method= getattr(self, name) 376if data is None:--> 377result = method(url, fp, errcode, errmsg, headers) 378 else: 379 result= method(url, fp, errcode, errmsg, headers, data)C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc inhttp_error_301(self, url, fp, errcode, errmsg, headers, data) 669def http_error_301(self, url, fp, errcode, errmsg, headers, data=None): 670"""Error 301 -- also relocated (permanently)."""--> 671return self.http_error_302(url, fp, errcode, errmsg, headers, data) 672673 def http_error_303(self, url, fp, errcode, errmsg, headers, data=None):C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc inhttp_error_302(self, url, fp, errcode, errmsg, headers, data) 639 "Internal Server Error: Redirect Recursion", headers) 640 result = self.redirect_internal(url, fp, errcode, errmsg, headers,--> 641 data) 642 self.tries= 0 643return resultC:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc inredirect_internal(self, url, fp, errcode, errmsg, headers, data) 665 headers) 666--> 667return self.open(newurl) 668669 def http_error_301(self, url, fp, errcode, errmsg, headers, data=None):C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc inopen(self, fullurl, data) 211try: 212if data is None:--> 213return getattr(self, name)(url) 214 else: 215return getattr(self, name)(url, data)C:\Users\pande\Anaconda2\envs\gl-env\lib\urllib.pyc in open_https(self, url, data) 441if realhost: h.putheader('Host', realhost) 442 for args in self.addheaders: h.putheader(*args)--> 443 h.endheaders(data) 444 errcode, errmsg, headers = h.getreply() 445 fp = h.getfile()C:\Users\pande\Anaconda2\envs\gl-env\lib\httplib.pyc in endheaders(self, message_body) 1051else: 1052raise CannotSendHeader()-> 1053self._send_output(message_body) 10541055 def request(self, method, url, body=None, headers={}):C:\Users\pande\Anaconda2\envs\gl-env\lib\httplib.pyc in _send_output(self, message_body) 895 msg+= message_body 896 message_body= None--> 897self.send(msg) 898if message_body is not None: 899#message_body was not a string (i.e. it is a file) andC:\Users\pande\Anaconda2\envs\gl-env\lib\httplib.pyc insend(self, data) 857if self.sock is None: 858if self.auto_open:--> 859self.connect() 860else: 861raise NotConnected()C:\Users\pande\Anaconda2\envs\gl-env\lib\httplib.pyc inconnect(self) 1268"Connect to a host on a given (SSL) port." 1269-> 1270HTTPConnection.connect(self) 12711272 if self._tunnel_host:C:\Users\pande\Anaconda2\envs\gl-env\lib\httplib.pyc inconnect(self) 834"""Connect to the host and port specified in __init__.""" 835 self.sock = self._create_connection((self.host,self.port),--> 836 self.timeout, self.source_address) 837 838 if self._tunnel_host:C:\Users\pande\Anaconda2\envs\gl-env\lib\socket.pyc in create_connection(address, timeout, source_address) 573574 if err is not None:--> 575raise err 576else: 577raise error("getaddrinfo returns an empty list")IOError: [Errno socket error] [Errno 10060]


然后,就没辙了。

只能求助于万能的互联网了。

以下文章对我帮助很大:

http://blog.csdn.net/u013569000/article/details/53886656

于是,按照这篇文章提供的方法,手动更新了dependencies.py文件,在Python Terminal (命令行工具,而不是Jupyter Notebook)中运行graphlab.get_dependencies()命令,终于成功了。


 Welcome to the GraphLab Create Terminal

 This terminal gives you access to the 'gl-env' Python environment
 where GraphLab Create and other useful packages, such as IPython and
 Jupyter Notebook, have been installed. Use 'conda' or 'pip' to manage
 packages for development.

 Your gl-env environment has been activated using the following command:

 activate gl-env

 To get started, type the commands 'ipython' and then 'import graphlab'.
 To open Jupyter Notebook, type 'jupyter notebook'.

[gl-env] C:\Users\pande>python
Python 2.7.11 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:58:36) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> 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_dependencies()

By running this 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

Downloading xz.
Extracting xz.
Downloading gcc-libs.
Extracting gcc-libs.
Copying gcc-libs into the installation directory.
>>>


经验:
1. 在Jupyter Notebook中键入命令,如果出错后,后续的命令往往得不到反馈(没反应)或者得不到正确的反馈。需要不断的重启Jupyter Notebook。感觉Jupyter Notebook的容错能力很有限。
2. 在Jupyter Notebook中键入命令时,似乎没有重新编译.py文件,导致对.py的更新没有反映出来,依然报错。
3. 在Python命令行中执行graphlab.get_dependencies()时,重新编译了.py文件,得到了更新后的.pyc文件。


猜你喜欢

转载自blog.csdn.net/hpdlzu80100/article/details/75269876