0
votes

I am following the tutorial at http://docs.ckan.org/en/ckan-2.6.2/theming/templates.html

I, of course, installed this version 2.6.2 and have successfully completed the default setup.

step6) When I run the command to serve: paster serve --reload /etc/ckan/default/development.ini

I get the following error:

ImportError: No module named plugin

I see a lot of people getting the same error, there must be a reason for that. see the link: https://github.com/ckan/ckan/issues/3146, ckan 2.3 problems with adding the example_template plugin

Does anyone have a solution for this?

Thanks in advance

complete stack trace:

> (default) root@videolan:/usr/lib/ckan/default/src/ckanext-example_theme# paster serve --reload /etc/ckan/default/production.ini
Starting subprocess with file monitor
Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/paster", line 11, in <module>
    sys.exit(run())
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 102, 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 141, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
    result = self.command()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 284, in command
    relative_to=base, global_conf=vars)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 329, in loadapp
    **kw)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/__init__.py", line 45, in make_app
    load_environment(conf, app_conf)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 97, in load_environment
    p.load_all()
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 139, in load_all
    load(*plugins)
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 153, in load
    service = _get_service(plugin)
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 255, in _get_service
    return plugin.load()(name=plugin_name)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2302, in load
    return self.resolve()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2308, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named plugin
1

1 Answers

1
votes

The problem is that there is that the main ckan repository also has an ckanext/example_theme (which is uses in its tests) and it's finding that one. That one doesn't have a plugin.py in the usual place, hence the error.

The solution is to use a different name than "example_theme".

There are two solutions:

  1. To convert an existing extension, you need to rename its "example_theme" directory, edit the path to it in setup.py's entry_points, and then run python setup.py develop again.

  2. Upgrade to CKAN 2.7.X (or later) and recreate the extension again. If you have any .pyc files in your extension directories, delete them. Restart CKAN.