ó —Ŕv]c@sŮdZddlZddlZddlZddlZddlZddlZy$ddlmZddl m Z Wn1e k rĽddl m Z ddl mZnXddl Z d„Zidd6dd 6d d 6d d 6dd6dd6Ziidd6dd6d6Zdd„Zd„Zd„Zd„Zd„Zd„Zd„ZedkrŐeƒZejrpeƒnejrƒeƒnejr–eƒnejrŠeƒnejrźeƒnejrŐeeƒqŐndS( s‡Diagnose script for checking OS/hardware/python/pip/mxnet/network. The output of this script can be a very good hint to issue/problem. i˙˙˙˙N(turlopen(turlparsec Csžtjdtjddƒ}dddddd g}x:|D]2}|jd |d d d tddj|ƒƒq:W|jdd dd tddƒ|jdd dd tddƒ|jƒ}|S(sParse arguments.tformatter_classt descriptions0Diagnose script for checking the current system.tpythontpiptmxnettosthardwaretnetworks--tdefaultittypethelps Diagnose {}.s--regionts|Additional sites in which region(s) to test. Specify 'cn' for example to test mirror sites in China.s --timeouti s0Connection test timeout threshold, 0 to disable.(targparsetArgumentParsertArgumentDefaultsHelpFormattert add_argumenttinttformattstrt parse_args(tparsertchoicestchoicetargs((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pyR!s     s)https://github.com/apache/incubator-mxnettMXNetshttp://gluon.mxnet.iosGluon Tutorial(en)shttps://zh.gluon.aisGluon Tutorial(cn)sqhttps://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gzt FashionMNISTs https://pypi.python.org/pypi/piptPYPIs$https://repo.continuum.io/pkgs/free/tCondashttps://pypi.douban.com/s PYPI(douban)s8https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/sConda(tsinghua)tcni c Csät|ƒ}tjƒ}ytj|jƒ}Wn(tk rX}dj|||ƒGHdSXtjƒ|}tjƒ}yt|d|ƒ}Wn+tk r¸}dj||||ƒGHdSXtjƒ|} dj|||| ƒGHdS(sSimple connection tests"Error resolving DNS for {}: {}, {}Nttimeouts.Error open {}: {}, {}, DNS finished in {} sec.s5Timing for {}: {}, DNS: {:.4f} sec, LOAD: {:.4f} sec.(Rttimetsockett gethostbynametnetloct ExceptionRR( tnameturlRturlinfotstarttiptet dns_elapsedt_t load_elapsed((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pyttest_connectionAs    cCsMdGHdtjƒfGHdtjƒfGHdtjƒfGHdtjƒfGHdS(Ns----------Python Info----------sVersion :sCompiler :sBuild :sArch :(tplatformtpython_versiontpython_compilert python_buildt architecture(((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pyt check_pythonTs cCsZdGHy8ddl}d|jfGHdtjj|jƒfGHWntk rUdGHnXdS(Ns------------Pip Info-----------i˙˙˙˙sVersion :sDirectory :s0No corresponding pip install for current python.(Rt __version__Rtpathtdirnamet__file__t ImportError(R((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pyt check_pip[s  cCsdGHyˆddl}d|jfGHtjj|jƒ}d|fGHtjj|dƒ}t|dƒ$}|jƒj ƒ}d|fGHWdQXWnpt k rĽdGHn[t k rşd GHnFt k r˙}ddl }t|t ƒsńd GHd GHn|jƒGHnXdS( Ns----------MXNet Info-----------i˙˙˙˙sVersion :sDirectory :t COMMIT_HASHtrsCommit Hash :sNo MXNet installed.s8Hashtag not found. Not installed from pre-built package.s(An error occured trying to import mxnet.sIThis is very likely due to missing missing or incompatible library files.(RR5RR6R7R8tjointopentreadtstripR9tIOErrorR$t tracebackt isinstancet format_exc(Rtmx_dirt commit_hashtftchR*RB((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pyt check_mxnetds(     cCs^dGHdtjƒfGHdtjƒfGHdtjƒfGHdtjƒfGHdtjƒfGHdS(Ns----------System Info----------sPlatform :ssystem :snode :srelease :sversion :(R/tsystemtnodetreleasetversion(((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pytcheck_oszs cCsűdGHdtjƒfGHdtjƒfGHtjjdƒr¤tjddtjƒ}|jƒd}x“|j d ƒD],}d |ksd |krq|j ƒGHqqqqWnStjjd ƒrÉtj d gƒn.tjjdƒr÷tj ddddgƒndS(Ns!----------Hardware Info----------smachine :sprocessor :tdarwintsysctls-atstdoutis t brand_stringtfeaturestlinuxtlscputwin32twmictcputgetR%(RPs-a( R/tmachinet processortsyst startswitht subprocesstPopentPIPEt communicatetsplitR@tcall(tpipetoutputtline((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pytcheck_hardware‚scCsědGH|jdkr5dj|jƒGHtjdƒnx€|jjƒjdƒD]f}|jƒjƒ}|srqNn|tkr’t j t|ƒqNddl }|j dj|ƒƒqNWx-t j ƒD]\}}t|||jƒqĹWdS(Ns ----------Network Test----------isSetting timeout: {}i t,i˙˙˙˙sBRegion {} do not need specific test, please refer to global sites.(RRR!tsetdefaulttimeouttregionR@Rbtlowert REGIONAL_URLStURLStupdatetwarningstwarntitemsR.(RRjR<RoR%R&((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pyt check_network‘s  t__main__(t__doc__R/R^R\RR!R turllib.requestRt urllib.parseRR9turllib2RRRmRlR.R4R:RIRNRgRrt__name__RRRRRR (((s5/tmp/pip-install-Qvdv_2/mxnet/mxnet/tools/diagnose.pytsT0