可收割机:"No module named pika"错误



在运行正常的 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

这是点要求的内容.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 新手)

这是因为您使用了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

最新更新