ckan / ckanext-validation

CKAN extension for validating Data Packages using Table Schema.
MIT License
28 stars 33 forks source link

Unable to add plug-in to CKAN instance #59

Closed tpgmartin closed 2 years ago

tpgmartin commented 2 years ago

Overview

I'm trying to add the ckanext-validation plug-in to my CKAN instance, which is running on EC2 Ubuntu 18.02 instance. I have followed the instructions to install and deploy CKAN from source, version 2.9.5. I've installed the plug-in following the instructions in the readme, but after I add the plugin "validation" to ckan.ini config file I get the following error:

Traceback (most recent call last):
  File "/usr/lib/ckan/default/src/ckan/wsgi.py", line 15, in <module>
    raise RuntimeError(u'CKAN config option not found: {}'.format(config_path))
RuntimeError: CKAN config option not found: /usr/lib/ckan/default/src/ckan/ckan.ini
unable to load app 0 (mountpoint='') (callable not found or import error)
2022-06-01 08:01:07,090 INFO  [ckan.config.environment] Loading static files from public
2022-06-01 08:01:07,194 INFO  [ckan.config.environment] Loading templates from /usr/lib/ckan/default/src/ckan/ckan/templates
Traceback (most recent call last):
  File "/etc/ckan/default/wsgi.py", line 20, in <module>
    application = make_app(config)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/__init__.py", line 56, in make_app
    load_environment(conf)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 123, in load_environment
    p.load_all()
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 165, in load_all
    load(*plugins)
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 179, in load
    service = _get_service(plugin)
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 281, in _get_service
    return plugin.load()(name=plugin_name)
  File "/usr/lib/ckan/default/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/ckan/default/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/ckan/default/src/ckanext-validation/ckanext/validation/plugin.py", line 12, in <module>
    from ckanext.validation.logic import (
  File "/usr/lib/ckan/default/src/ckanext-validation/ckanext/validation/logic.py", line 470
    except t.ValidationError, e:
                            ^
SyntaxError: invalid syntax
unable to load app 0 (mountpoint='') (callable not found or import error)

This error is only raised if I include the "validation" plug-in in the ckan.plugins config options.

I've added by the ckanext-validation and ckanext-scheming plug-ins and included these in the ckan.ini file as named plug-ins, I've also added the following to my ckan.ini file as per the readme,

scheming.dataset_schemas = ckanext.validation.examples:ckan_default_schema.json
scheming.presets = ckanext.scheming:presets.json
                   ckanext.validation:presets.json

Is this a consequence of where the ckanext-validaton and ckanext-scheming plugins are installed? If I install with pip by default they are installed to /usr/lib/ckan/default/src not /usr/lib/ckan/default/src/ckan/ckanext as is usual for other plug-ins.


Please preserve this line to notify @amercader (lead of this repository)

amercader commented 2 years ago

Unfortunately ckanext-validation hasn't been updated to work on CKAN 2.9 / Python 3 yet. All these errors arise from that issue, sorry about that

tpgmartin commented 2 years ago

@amercader many thanks for your reply, are the required changes relatively straightforward? If so, could you please advise what I'd need to change? Cheers

amercader commented 2 years ago

@tpgmartin see https://github.com/frictionlessdata/ckanext-validation/issues/61

ThrawnCA commented 2 years ago

@tpgmartin The keitaroinc/ckanext-validation and qld-gov-au/ckanext-validation forks have Python 3 support.