红联Linux门户
Linux帮助

Ubuntu下配置Hue的各种问题

发布时间:2016-08-22 10:00:07来源:linux网站作者:cuihaolong
首先需要根据官网提示安装各种依赖库,然后运行make apps,期间会出现各种问题。
 
1.卡在如下处然后显示timed out或者CRC check不符
~/hue/build/env/local/lib/python2.7/site-packages/pkg_resources/__init__.py:2510: PEP440Warning: 'logilab (common-0.51.0)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.  
PEP440Warning,  
使用sudo pip install --upgrade logilab更新提到的旧版本,然后再次运行即可。
 
2.关于daemon.pidlockfile错误
File "~/hue/desktop/core/src/desktop/supervisor.py", line 32, in <module>  
from daemon.pidlockfile import PIDLockFile  
ImportError: No module named daemon.pidlockfile  
参考Bug 612403 - TypeError importing daemon.pidlockfile after updating to python-lockfile-0.9(https://bugzilla.redhat.com/show_bug.cgi?id=612403)
更新python-daemon之后显示
File "~/hue/desktop/core/src/desktop/supervisor.py", line 32, in <module>  
from daemon.pidlockfile import PIDLockFile  
ImportError: No module named pidlockfile  
修改~/hue/desktop/core/src/desktop/supervisor.py中的from daemon.pidlockfile为daemon.pidfile后,报错
File "~/hue/desktop/core/src/desktop/log/formatter.py", line 21, in <module>  
from pytz import UnknownTimeZoneError, datetime, timezone  
ImportError: No module named pytz  
更新sudo pip install --upgrade pytz后出现
File "~/hue/desktop/core/src/desktop/manage_entry.py", line 37, in entry  
from django.core.exceptions import ImproperlyConfigured  
ImportError: No module named django.core.exceptions  
说明需要安装django
 
3.安装django:sudo pip install django后出现
File "~/hue/desktop/core/src/desktop/manage_entry.py", line 38, in entry  
from django.core.management import execute_from_command_line, find_commands, find_management_module  
ImportError: cannot import name find_management_module  
参考扩展Django:实现自己的manage命令(http://www.cnblogs.com/holbrook/archive/2012/03/09/2387679.html) 修改/usr/local/lib/python2.7/dist-packages/django/core/management中的__init__.py
之后出现
File "~/hue/desktop/core/src/desktop/manage_entry.py", line 39, in entry  
from django.core.management import LaxOptionParser  
ImportError: cannot import name LaxOptionParser  
由此可知是django新版本与旧版本的兼容问题,所以参考Main Stack(https://github.com/cloudera/hue) 下载django1.6.11代替新版本
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__  
% (self.SETTINGS_MODULE, e)  
ImportError: Could not import settings 'desktop.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named guppy  
继续用pip安装guppy
ImportError: Could not import settings 'desktop.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named configobj  
安装configobj
ImportError: Could not import settings 'desktop.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named boto.exception  
安装boto,pyformance,此时将django需要的依赖安装完成
 
4.No module named axes
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module  
__import__(name)  
ImportError: No module named axes  
安装django-axes,查看本次错误之前的详细信息发现这段信息
Installed ~/hue/desktop/libs/notebook/src  
说明当前正在安装notebook的源代码,而
File "~/hue/desktop/core/src/desktop/manage_entry.py", line 59, in entry  
execute_from_command_line(sys.argv)  
控制着从hue向django发出的命令,查看desktop文件夹发现core/build下有许多文件夹与缺少的module名称相符,继续查看错误信息发现
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch  
app = import_module(appname)  
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module  
__import__(name)  
其中appname由settings.INSTALLED_APPS获得,INSTALLED_APPS列表对应到~/hue/desktop/core/build下的所有文件,因此安装过程中缺少的module可以在~/hue/desktop/core/build下找到完整名称来使用pip安装。
按照这种方法安装了BabelDjango,South,django-openid-auth-0.5,django-extensions-1.5.0,sasl,thrift,requests-2.10.0,requests-kerberos-0.6.1,Mako-0.8.1
 
5.django版本引起的错误
File "/usr/local/lib/python2.7/dist-packages/django_openid_auth/migrations/0001_initial.py", line 4, in <module>  
from django.db import models, migrations  
ImportError: cannot import name migration  
参考stackoverflow.com得知,django1.7以后才出现migration,而1.10版本不可以用,所以更新到1.7,但又会出现3中的错误,因此进入
/usr/local/lib/python2.7/dist-packages/django/core/management,将其中的__init__.py替换为1.6版本中的即可。
 
6.django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 124, in check_apps_ready  
raise AppRegistryNotReady("Apps aren't loaded yet.")  
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.  
6.1 尝试将~/hue/desktop/core/build与/usr/local/lib/python2.7/dist-packages对比,安装/usr下缺少的
avro-1.7.6,cryptography-1.3.1,django-auth-ldap-1.2.0,django-nose-1.3,djangosaml2-0.13.0,elementtree(未找到对应版本),enum-0.4.4,importlib-1.0.3,jdcal-1.0.1,kazoo-2.0,markdown,MySQL-python-1.2.5,openpyxl-2.3.0-b2,ordereddict-1.1,parquet-python(名称应为parquet),py4j-0.9,pyasn1-0.1.8,python-oauth2,pytidylib-0.2.1,ssl-1.15(编译出错),tablib-0.10.0,urllib2_kerberos-0.1.6
以avro为例,安装最新版本用命令sudo pip install avro,安装指定版本sudo pip install avro==1.7.6
ssl无法在python2.6及以后的版本中编译参考ssl 1.16(https://pypi.python.org/pypi/ssl) 以及 ssl issues(https://github.com/pypa/ssl/issues)
elementtree参考elementtree 1.2.6-20050316(https://pypi.python.org/pypi/elementtree/1.2.6-20050316) 在Download elementtree (http://effbot.org/downloads#elementtree)处下载并解压,进入目录执行python setup.py build和python setup.py install即可安装
这些都安装完后仍报错。
6.2 查看/usr/local/lib/python2.7/dist-packages/django/apps下的registry.py和config.py,其中registry.py说明在运行初期需要检查installed_apps中的app是否全部import,没有则报错,而config.py中说明了app的名称和路径以及module的关系。
/usr/local/lib/python2.7/dist-packages/django/conf/保存配置信息,__init__.py用INSTALLED_APPS和TEMPLATE_DIRS初始化了tuple_settings变量,INSTALLED_APPS和TEMPLATE_DIRS在global_settings.py中声明。
/usr/local/lib/python2.7/dist-packages/django/conf/locale保存着django的语言包。
/usr/local/lib/python2.7/dist-packages/django/conf/project_template/project_name下的settings.py中涉及到了INSTALLED_APPS,但是其中列出的均已在相应路径下存在。
于是查看hue相关设置里面的INSTALLED_APPS,在~/hue/desktop/core/src/desktop下的settings.py中找到,django.contrib.auth形式的到/usr/local/lib/python2.7/dist-packages/django/contrib/下看是否有auth,django_openid_auth形式的到/usr/local/lib/python2.7/dist-packages/下查看是否有django_openid_auth,发现缺少desktop,于是使用pip安装,还有错误。
6.3 继续查看发现后面对INSTALLED_APPS有一些追加操作,于是继续安装。
安装saml过程中需要xmlsec的支持,但安装xmlsec时没有pkg-config,于是sudo apt-get install pkg-config来安装,然后安装xmlsec出错为
src/xmlsec.h:2:30: fatal error: xmlsec/templates.h: 没有那个文件或目录  
参考Pip install dev dependencies fails on python 2.7(https://github.com/mehcode/python-xmlsec/issues/24) 中的回答安装了libxml2-dev libxmlsec1-dev,然后xmlsec安装成功,进而saml安装成功。
安装OAuth,用pip即可。
安装OpenId,使用python-openid作为名称。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/23514.html