Pyleus build发生import问题,pyleus通过thrift连接hbase

hellohhhello 2016-01-08 01:04:35
使用pyleus,在bolt中打算使用thrift连接hbase,因此有

from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from hbase import Hbase
from hbase.ttypes import *

由于有:
1、thrift-0.9.1.tar.gz(包含setup.py)
2、 requirements.txt中thrift

thrift的import正常,

但是在hbase import的时候,总是报ImportError: No module named hbase。这个该如何处理呢?

thrift有pip源。hbase能否也找到相应的文件呢?

具体错误信息如下:
[root@vm-kafka01]# pyleus --verbose build word_count/pyleus_topology.yaml
New python executable in /tmp/tmp9CgVsa/resources/pyleus_venv/bin/python
Installing setuptools, pip, wheel...done.
Collecting pyleus==0.2.2
Collecting msgpack-python (from pyleus==0.2.2)
Requirement already satisfied (use --upgrade to upgrade): argparse in /tmp/tmp9CgVsa/resources/pyleus_venv/lib/python2.6/site-packages (from pyleus==0.2.2)
Collecting virtualenv (from pyleus==0.2.2)
Collecting PyYAML (from pyleus==0.2.2)
DEPRECATION: Failed to find 'PyYAML' at http://172.17.18.61/simple/pyyaml/. It is suggested to upgrade your index to support normalized names as the name in /simple/{name}.
Installing collected packages: msgpack-python, virtualenv, PyYAML, pyleus
Successfully installed PyYAML-3.11 msgpack-python-0.4.2 pyleus-0.2.2 virtualenv-13.1.2
Processing /tmp/thrift
Installing collected packages: thrift
Running setup.py install for thrift
Successfully installed thrift-0.9.1

pyleus build: error: [VirtualenvError] Failed to execute Python module: word_count.log_results. Error: Traceback (most recent call last):
File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/tmp/tmp9CgVsa/resources/word_count/log_results.py", line 7, in <module>
from hbase import Hbase
ImportError: No module named hbase



多谢~~
...全文
429 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hellohhhello 2016-01-12
  • 打赏
  • 举报
回复
多谢~~ 刚刚手滑就提交了,谢谢~~ 如果有时间的话,能不能再帮忙看看后续 [root@vm-kafka01]# pyleus --verbose build word_count/pyleus_topology.yaml New python executable in /tmp/tmpCK2Zj3/resources/pyleus_venv/bin/python Installing setuptools, pip, wheel...done. Collecting pyleus==0.2.2 Collecting msgpack-python (from pyleus==0.2.2) Requirement already satisfied (use --upgrade to upgrade): argparse in /tmp/tmpCK2Zj3/resources/pyleus_venv/lib/python2.6/site-packages (from pyleus==0.2.2) Collecting virtualenv (from pyleus==0.2.2) Collecting PyYAML (from pyleus==0.2.2) DEPRECATION: Failed to find 'PyYAML' at http://IP/simple/pyyaml/. It is suggested to upgrade your index to support normalized names as the name in /simple/{name}. Installing collected packages: msgpack-python, virtualenv, PyYAML, pyleus Successfully installed PyYAML-3.11 msgpack-python-0.4.2 pyleus-0.2.2 virtualenv-13.1.2 Processing /tmp/thrift Processing /tmp/hbase Requirement already satisfied (use --upgrade to upgrade): setuptools in /tmp/tmpCK2Zj3/resources/pyleus_venv/lib/python2.6/site-packages (from hbase==3.7.0->-r /opt/app/liu_rui/word_count/requirements.txt (line 2)) Collecting desktop (from hbase==3.7.0->-r /opt/app/liu_rui/word_count/requirements.txt (line 2)) Downloading http://172.17.18.61/simple/desktop/desktop-0.4.2.tar.gz Building wheels for collected packages: desktop Running setup.py bdist_wheel for desktop Stored in directory: /root/.cache/pip/wheels/69/dd/ff/be6fb6413114485eb970551127a913f2232c3560cbdafc2dbd Successfully built desktop Installing collected packages: thrift, desktop, hbase Running setup.py install for thrift Running setup.py install for hbase Successfully installed desktop-0.4.2 hbase-3.7.0 thrift-0.9.1 pyleus build: error: [VirtualenvError] Failed to execute Python module: word_count.log_results. Error: Traceback (most recent call last): File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code exec code in run_globals File "/tmp/tmpCK2Zj3/resources/word_count/log_results.py", line 7, in <module> from hbase import Hbase ImportError: cannot import name Hbase 这怎么前后还不一样,hbase这个到底import了没~~
hellohhhello 2016-01-12
  • 打赏
  • 举报
回复
您好: desktop的pip源已经加上了,上面的问题也就不再了。
hellohhhello 2016-01-11
  • 打赏
  • 举报
回复
多谢~~ 用您的方法,果然解决了,谢谢 可是现在又有这么个问题,说是在pip源上找不到desktop,我理解,是不是一定要在pip源上加上这个才可以,这个和hbase的使用又有什么关系呢?因为加pip源还要再去找别的同事,好麻烦的,不知道能不能本地解决呢,多谢 [root@vm-kafka01 ]# pyleus --verbose build word_count/pyleus_topology.yaml New python executable in /tmp/tmpL8oDPZ/resources/pyleus_venv/bin/python Installing setuptools, pip, wheel...done. Collecting pyleus==0.2.2 Collecting msgpack-python (from pyleus==0.2.2) Requirement already satisfied (use --upgrade to upgrade): argparse in /tmp/tmpL8oDPZ/resources/pyleus_venv/lib/python2.6/site-packages (from pyleus==0.2.2) Collecting virtualenv (from pyleus==0.2.2) Collecting PyYAML (from pyleus==0.2.2) DEPRECATION: Failed to find 'PyYAML' at http://pip源ip/simple/pyyaml/. It is suggested to upgrade your index to support normalized names as the name in /simple/{name}. Installing collected packages: msgpack-python, virtualenv, PyYAML, pyleus Successfully installed PyYAML-3.11 msgpack-python-0.4.2 pyleus-0.2.2 virtualenv-13.1.2 Processing /tmp/thrift Processing /tmp/hbase Requirement already satisfied (use --upgrade to upgrade): setuptools in /tmp/tmpL8oDPZ/resources/pyleus_venv/lib/python2.6/site-packages (from hbase==3.7.0->-r /opt/app/word_count/requirements.txt (line 2)) Collecting desktop (from hbase==3.7.0->-r /opt/app/word_count/requirements.txt (line 2)) DEPRECATION: Failed to find 'desktop' at http://pip源ip/simple/desktop/. It is suggested to upgrade your index to support normalized names as the name in /simple/{name}. Could not find a version that satisfies the requirement desktop (from hbase==3.7.0->-r /opt/app/word_count/requirements.txt (line 2)) (from versions: ) No matching distribution found for desktop (from hbase==3.7.0->-r /opt/app/word_count/requirements.txt (line 2)) pyleus build: error: [VirtualenvError] Failed to install dependencies for this topology. Run with --verbose for detailed info.
pcboyxhy 2016-01-08
  • 打赏
  • 举报
回复
Okay, I figured it out. If anyone else is having problems with this in the future its actually pretty easy. In the step where you run thrift --gen py Hbase.thrift, it creates a hbase folder in the location you ran that command. Simply take that command and copy it to your default module folder(or in the folder where you run your program and it should work).

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧