ckan harvester:“没有名为pika的模块”错误

时间:2015-01-23 00:07:48

标签: plugins ckan data-harvest

在运行正常的ckan实例上,我按照本指南安装了收割机扩展程序:https://github.com/ckan/ckanext-harvest

这些是我遵循的步骤:

. /usr/lib/ckan/default/bin/activate
cd /usr/lib/ckan/default/src/ckan

sudo pip install -e git+https://github.com/okfn/ckanext-harvest.git@stable#egg=ckanext-harvest

cd /usr/lib/ckan/default/src/ckan/src/ckanext-harvest
sudo pip install -r pip-requirements.txt

这是pip-requirements.txt的内容:

pika==0.9.8
redis==2.10.1

我继续配置插件,一切似乎都正常。我让它在http://localhost/harvest运行。然后我创建了一个新的源代码,当我想启动gather命令时,我得到了这个错误:

$ . /usr/lib/ckan/default/bin/activate
$ cd /usr/lib/ckan/default/src/ckan/src/ckanext-harvest
$ paster --plugin=ckanext-harvest harvester gather_consumer --config=/etc/ckan/default/production.ini 

Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
    load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
    result = self.command()
  File "/usr/lib/ckan/default/src/ckan/src/ckanext-harvest/ckanext/harvest/commands/harvester.py", line 125, in command
    from ckanext.harvest.queue import get_gather_consumer, gather_callback
  File "/usr/lib/ckan/default/src/ckan/src/ckanext-harvest/ckanext/harvest/queue.py", line 5, in <module>
    import pika
ImportError: No module named pika

我很确定virtualenv(这里有python新手)肯定会有些傻事。

1 个答案:

答案 0 :(得分:0)

这是因为您使用了sudo pip。由于python的virtualenv如何工作,如果你想使用sudo安装到virtualenv中,你需要提供pip的完整路径。像这样的东西会起作用

sudo /usr/lib/ckan/default/bin/pip -e git+https://github.com/okfn/ckanext-harvest.git@stable#egg=ckanext-harvest
cd /usr/lib/ckan/default/src/ckanext-harvest
sudo /usr/lib/ckan/default/bin/pip install -r pip-requirements.txt