Skip to content

Instantly share code, notes, and snippets.

@davidread
Last active December 22, 2021 09:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davidread/a6b47f2ebada39ed21fe66016702805b to your computer and use it in GitHub Desktop.
Save davidread/a6b47f2ebada39ed21fe66016702805b to your computer and use it in GitHub Desktop.
CKAN errors help
Lots of stack traces and error messages for CKAN, followed by a comment about how I fixed it (that time).
NB don't email me privately for help - ask on StackOverflow #ckan instead.
David
File "/vagrant/src/ckan/ckan/templates/home/snippets/search.html", line 1, in top-level template code
{% set tags = h.get_facet_items_dict('tags', limit=3) %}
File "/vagrant/src/ckan/ckan/lib/helpers.py", line 949, in get_facet_items_dict
if not c.search_facets or \
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
File "/vagrant/src/ckan/ckan/config/middleware/flask_app.py", line 316, in __getattr__
return getattr(app_globals.app_globals, name)
AttributeError: '_Globals' object has no attribute 'search_facets'
# fixed by restarting jetty - it was not working.
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/plugins/manager.py", line 167, in simple
result = meth(*arg, **kw)
File "/usr/lib/ckan/default/src/ckan/ckan/ckan_nose_plugin.py", line 20, in startContext
import ckan.model as model
AttributeError: 'module' object has no attribute 'model'
# fixed this error by doing:
# cd /vagrant/src/ckan
# python setup.py develop
Traceback (most recent call last):
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/vagrant/src/ckan/ckan/tests/test_authz.py", line 6, in <module>
ckan.authz
AttributeError: 'module' object has no attribute 'authz'
# fixed this error by doing:
# cd /vagrant/src/ckan
# python setup.py develop
ProgrammingError: (psycopg2.ProgrammingError) relation "_table_metadata" does not exist
# fixed by running set-permissions command:
# paster --plugin=ckan datastore set-permissions -c test-core.ini | sudo -u postgres psql --set ON_ERROR_STOP=1
File "/vagrant/src/ckan/ckanext/datastore/plugin.py", line 13, in <module>
import ckanext.datastore.logic.action as action
File "/vagrant/src/ckan/ckanext/datastore/logic/action.py", line 19, in <module>
from ckanext.datastore.backend.postgres import identifier
File "/vagrant/src/ckan/ckanext/datastore/backend/postgres.py", line 28, in <module>
from psycopg2.extras import register_default_json, register_composite
ImportError: cannot import name register_default_json
# fixed by: pip install requirements.txt
# probably for: psycopg2-2.7.3.2
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/httpretty/core.py", line 523, in validate
if igot > self.body_length:
UnboundLocalError: local variable 'igot' referenced before assignment
# fixed by upgrading httpretty-0.8.3 -> 0.8.14
File "/vagrant/src/ckan/ckan/migration/versions/008_update_vdm_ids.py", line 44, in drop_constraints_and_alter_types
id_col = constraint.table.columns[constraint.columns[0]]
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/util/_collections.py", line 194, in __getitem__
return self._data[key]
KeyError: 0
# wrong version of sqlalchemy - pip install -r requirements.txt
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/version.py", line 207, in script
"There is no script for %d version" % self.version
AssertionError: There is no script for 86 version
# stray pyc files
# find . -name "*.pyc"|xargs rm
File "/vagrant/src/ckan/ckan/views/user.py", line 151, in read
File "/vagrant/src/ckan/ckan/lib/base.py", line 193, in render
return flask_render_template(template_name, **extra_vars)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/flask/templating.py", line 134, in render_template
context, ctx.app)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/flask/templating.py", line 116, in _render
rv = template.render(context)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "/vagrant/src/ckan/ckan/templates/user/read.html", line 1, in top-level template code
{% extends "user/read_base.html" %}
File "/vagrant/src/ckan/ckan/templates/user/read_base.html", line 3, in top-level template code
{% set user = c.user_dict %}
File "/vagrant/src/ckan/ckan/templates/page.html", line 1, in top-level template code
{% extends "base.html" %}
File "/vagrant/src/ckan/ckan/templates/base.html", line 41, in top-level template code
{%- block title -%}
File "/vagrant/src/ckan/ckan/templates/base.html", line 42, in block "title"
{%- block subtitle %}{% endblock -%}
File "/vagrant/src/ckan/ckan/templates/user/read_base.html", line 5, in block "subtitle"
{% block subtitle %}{{ user.display_name }} - {{ _('Users') }}{% endblock %}
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/jinja2/environment.py", line 408, in getattr
return getattr(obj, attribute)
UndefinedError: 'werkzeug.local.LocalProxy object' has no attribute 'user_dict'
# stray pyc files
# find . -name "*.pyc"|xargs rm
When installing requirements.txt for 2.5.7:
ImportError: No module named testrepository
# Apparently it's to do with setuptools version.
# $ easy_install --version
# setuptools 36.1.0 from /usr/lib/ckan/default/lib/python2.7/site-packages (Python 2.7)
# https://bugs.launchpad.net/tempest/+bug/1530026
# suggests its a bug exposed by setuptools changes
# pip install testrepository
# pip install -r requirements.txt
LoaderError: Could not create the database table: (psycopg2.ProgrammingError) function populate_full_text_trigger() does not exist
# paster --plugin=ckan datastore set-permissions | sudo -u postgres psql --set ON_ERROR_STOP=1
# paster --plugin=ckan datastore set-permissions -c ../ckanext-xloader/test.ini| sudo -u postgres psql --set ON_ERROR_STOP=1
nosetests --ckan --with-pylons=test-core.ini ckanext/datastore/tests/test_dump.py:TestDatastoreDump.test_dump_basic -s
...
ProgrammingError: (psycopg2.ProgrammingError) function populate_full_text_trigger() does not exist
[SQL: 'CREATE TRIGGER zfulltext\n BEFORE INSERT OR UPDATE ON "b761c191-3534-4b30-84d6-d515347f0eed"\n FOR EACH ROW EXECUTE PROCEDURE populate_full_text_trigger()']
# needed to run:
# sudo -u postgres psql datastore_default -f ../ckanext-xloader/full_text_function.sql
# sudo -u postgres psql datastore_test -f ../ckanext-xloader/full_text_function.sql
paster --plugin=ckanext-rq jobs -c $CKAN_INI list
File "/usr/lib/ckan/default/src/ckanext-rq/ckanext/rq/cli.py", line 86, in command
self.list()
File "/usr/lib/ckan/default/src/ckanext-rq/ckanext/rq/cli.py", line 106, in list
jobs = p.toolkit.get_action(u'job_list')({}, data_dict)
File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line 347, in get_action
raise KeyError("Action '%s' not found" % action)
KeyError: u"Action 'job_list' not found"
# fixed by adding rq to the ckan.plugins
nosetests --with-pylons test.ini ckanext/shift/tests/test_jobs.py -s
ERROR: ckanext.shift.tests.test_jobs.TestShiftDataIntoDatastore.test_simple_csv
File "/vagrant/src/ckanext-shift/ckanext/shift/tests/test_jobs.py", line 27, in test
requests.get(u'http://127.0.0.1:8983/solr/ckan/select/?Error during load: Could not create the database table: SOLR returned an error running query: {'fq': ['site_id:"test.ckan.net"', u'+site_id:"test.ckan.net"', '+state:active'], 'facet.mincount': 1, 'rows': 2, 'facet': 'true', 'q': 'id:"31ea345d-02c1-4e7d-b64e-f4d9509b99cc"', 'facet.limit': '50', 'wt': 'json', 'fl': 'data_dict'} Error: SolrError(u'Failed to connect to server at \'http://127.0.0.1:8983/solr/ckan/select/?fq=site_id%3A%22test.ckan.net%22&fq=%2Bsite_id%3A%22test.ckan.net%22&fq=%2Bstate%3Aactive&facet.mincount=1&rows=2&facet=true&q=id%3A%2231ea345d-02c1-4e7d-b64e-f4d9509b99cc%22&facet.limit=50&wt=json&fl=data_dict\', are you sure that URL is correct? Checking it in a browser might help: (\'Connection aborted.\', BadStatusLine("\'\'",))',)
# Due to httpretty causing unregistered urls to not work, such as this call to SOLR. Maybe to do incompat with requests version.
# We have httpretty==0.8.14 (latest). Trying older one suggested:
# pip install httpretty==0.6.4
# appears to fix it
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused
# CKAN logs show it couldn't connect to the db - it wasn't ready that time
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column "id" referenced in foreign key constraint does not exist" during "upgrade_db"
# issue: https://github.com/ckan/ckan/issues/3929
# added one-liner - https://github.com/ckan/ckan/pull/4016
ERROR: no CKAN_SQLALCHEMY_URL specified in docker-compose.yml
# no bind mount specified, so not surprised it fails
ImportError: cannot import name http_cookies
docker run -it --entrypoint=/bin/bash -v /Users/davidread/ckan/volumes/ckan_home:/usr/lib/ckan docker_ckan
. /usr/lib/ckan/venv/bin/activate
# requirements.txt:
# Either: change the build-copy, rebuild and then re-copy the venv to your local bind-mounted dir OR change the copy in the local/bind-mounted dir, log-in and ckan-pip install it
# I did the latter
# Upgrading beaker to 1.9.0 fixed the http_cookies problem
File "/usr/lib/ckan/venv/src/ckan/ckan/lib/redis.py", line 14, in <module>
from redis import ConnectionPool, Redis
File "/usr/lib/ckan/venv/src/ckan/ckan/lib/redis.py", line 14, in <module>
from redis import ConnectionPool, Redis
ImportError: cannot import name ConnectionPool
# i.e. circular import. NOT to do with macos being case insensitive (linux is not)
# is because ckan/lib is in the python path, so ckan's redis.py is getting picked ahead of the redis library module
File "/vagrant/src/ckanext-fluent/ckanext/fluent/helpers.py", line 3, in <module>
from ckanext.scheming.helpers import scheming_language_text
ImportError: No module named scheming.helpers
# Needs ckanext-scheming
Module /vagrant/src/ckanext-bostonschema/ckanext/bostonschema/templates/scheming/package/read.html:14 in block "package_notes"
>> {% set view = h.get_canonical_resource_view(pkg.id) %}
Module jinja2.environment:412 in getattr view
>> return obj[attribute]
Module ckan.lib.helpers:79 in __getitem__ view
>> key=key
HelperError: Helper 'get_canonical_resource_view' has not been defined.
# install ckanext-featuredviews
File '/vagrant/src/ckan/ckan/controllers/package.py', line 421 in read
'is_activity_archive': bool(activity_id),
File '/vagrant/src/ckan/ckan/lib/base.py', line 195 in render
return cached_template(template_name, render_template)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/templating.py', line 249 in cached_template
return render_func()
File '/vagrant/src/ckan/ckan/lib/base.py', line 137 in render_template
return render_jinja2(template_name, globs)
File '/vagrant/src/ckan/ckan/lib/base.py', line 94 in render_jinja2
return template.render(**extra_vars)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/jinja2/environment.py', line 989 in render
return self.environment.handle_exception(exc_info, True)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/jinja2/environment.py', line 754 in handle_exception
reraise(exc_type, exc_value, tb)
File '/vagrant/src/ckanext-bostonschema/ckanext/bostonschema/templates/scheming/package/read.html', line 1 in top-level template code
{% ckan_extends %}
File '/vagrant/src/ckanext-scheming/ckanext/scheming/templates/scheming/package/read.html', line 3 in top-level template code
{%- set schema = h.scheming_get_dataset_schema(dataset_type) -%}
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/jinja2/environment.py', line 412 in getattr
return obj[attribute]
File '/vagrant/src/ckan/ckan/lib/helpers.py', line 79 in __getitem__
key=key
HelperError: Helper 'scheming_get_dataset_schema' has not been defined.
# Fixed by enabling plugin: scheming_datasets
$ paster --plugin=abc
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 91, in run
commands = get_commands()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 133, in get_commands
plugins = pluginlib.resolve_plugins(plugins)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/pluginlib.py", line 83, in resolve_plugins
pkg_resources.require(plugin)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 971, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 857, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound
# I got the name of the plugin wrong and it can't find it. should be 'ckan' or 'ckanext-harvest' etc
$ paster --plugin=ckan datapusher submit periodic-groundwater-level-measurements
Data in any datastore resource that isn't in their source files (e.g. data added using the datastore API) will be permanently lost. Are you sure you want to proceed? [y/n] y
Submitting 1 datastore resources
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 "/vagrant/src/ckan/ckanext/datapusher/cli.py", line 59, in command
self._submit_package(self.args[1])
File "/vagrant/src/ckan/ckanext/datapusher/cli.py", line 100, in _submit_package
self._submit(resource_ids)
File "/vagrant/src/ckan/ckanext/datapusher/cli.py", line 108, in _submit
datapusher_submit = p.toolkit.get_action('datapusher_submit')
File "/vagrant/src/ckan/ckan/logic/__init__.py", line 384, in get_action
raise KeyError("Action '%s' not found" % action)
KeyError: "Action 'datapusher_submit' not found"
# Fixed by enabling the ckanext-datapusher extension, by adding it to my development.ini's ckan.plugins:
# ckan.plugins = stats text_view image_view recline_view datastore datapusher
End of script output before headers: apache.wsgi
# (seen in the apache errors log)
# Occurs straight as soon as CKAN talks to postgres, in this line in model/__init__.py:
# version_table = Table('migrate_version', meta.metadata, autoload=True)
# I don't know what the problem was - the apache config looked fine. But I fixed it by completely reinstalling apache2:
# sudo apt-get remove apache2
# sudo mv /etc/apache2 /etc/apache2-old
# sudo apt-get purge apache2
# sudo apt-get install apache2
Error viewing a dataset:
File "/vagrant/src/ckan/ckan/lib/helpers.py", line 1758, in follow_button
following = logic.get_action(action)(context, {'id': obj_id})
File "/vagrant/src/ckan/ckan/logic/__init__.py", line 464, in wrapped
result = _action(context, data_dict, **kw)
File "/vagrant/src/ckan/ckan/logic/action/get.py", line 2872, in am_following_dataset
context['model'].UserFollowingDataset)
File "/vagrant/src/ckan/ckan/logic/action/get.py", line 2838, in _am_following
raise logic.NotAuthorized
# This particular NotAuthorized is caused by being logged in as a user, then that user is wiped from the database (e.g. restoring the db from a backup) and then you view a dataset.
# Fixed by logging out (even though it doesn't say you are logged in): browse to /user/logout
At: /dataset/
File "/vagrant/src/ckan/ckan/templates/snippets/package_item.html", line 36, in block "heading_title"
{{ h.link_to(h.truncate(title, truncate_title), h.url_for('%s.read' % package.type, id=package.name)) }}
File "/vagrant/src/ckan/ckan/lib/helpers.py", line 324, in url_for
my_url = _url_for_pylons(*args, **kw)
File "/vagrant/src/ckan/ckan/lib/helpers.py", line 413, in _url_for_pylons
return _routes_default_url_for(*args, **kw)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/routes/util.py", line 265, in url_for
"unicode instead: %s" % url)
GenerationException: url_for can only return a string, got unicode instead: harvest.read?id=csw-test
# Due to trying to display a 'harvest' type dataset. Should not be included in search.
# CKAN 1.9+'s dataset view changes default and returns all datasets types.
# Harvest extension uses before_search to filter out harvest type datasets.
# Fixed by enabling harvest extension in production.ini's ckan.plugins.
nosetests --with-pylons test.ini --ckan ../ckanext-xloader/ckanext/xloader/tests
File "/vagrant/src/ckanext-xloader/ckanext/xloader/tests/test_action.py", line 17, in setup_class
p.load('datastore')
File "/vagrant/src/ckan/ckan/plugins/core.py", line 168, in load
plugins_update()
File "/vagrant/src/ckan/ckan/plugins/core.py", line 122, in plugins_update
environment.update_config()
File "/vagrant/src/ckan/ckan/config/environment.py", line 298, in update_config
plugin.configure(config)
File "/vagrant/src/ckan/ckanext/datastore/plugin.py", line 80, in configure
self.backend.configure(config)
File "/vagrant/src/ckan/ckanext/datastore/backend/postgres.py", line 1695, in configure
if self._is_read_only_database():
File "/vagrant/src/ckan/ckanext/datastore/backend/postgres.py", line 1613, in _is_read_only_database
connection = _get_engine_from_url(url).connect()
File "/vagrant/src/ckan/ckanext/datastore/backend/postgres.py", line 128, in _get_engine_from_url
loads=lambda x: x)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/psycopg2/_json.py", line 165, in register_default_json
loads=loads, oid=JSON_OID, array_oid=JSONARRAY_OID)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/psycopg2/_json.py", line 147, in register_json
register_type(JSON, not globally and conn_or_curs or None)
TypeError: argument 2 must be a connection, cursor or None
# due to using sqlite database, instead of the postgres these tests were expecting. switch to test-core.ini:
# nosetests --with-pylons test-core.ini --ckan ../ckanext-xloader/ckanext/xloader/tests
$ nosetests --ckan --with-pylons=test-core.ini ckan/tests/test_coding_standards.py:test_building_the_docs
======================================================================
ERROR: test suite for <module 'ckan.tests.test_coding_standards' from '/vagrant/src/ckan/ckan/tests/test_coding_standards.py'>
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/suite.py", line 209, in run
self.setUp()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/suite.py", line 292, in setUp
self.setupContext(ancestor)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/suite.py", line 301, in setupContext
self.config.plugins.startContext(context)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/plugins/manager.py", line 99, in __call__
return self.call(*arg, **kw)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/plugins/manager.py", line 167, in simple
result = meth(*arg, **kw)
File "/usr/lib/ckan/default/src/ckan/ckan/ckan_nose_plugin.py", line 20, in startContext
import ckan.model as model
AttributeError: 'module' object has no attribute 'model'
# fixed by reinstalling ckan source into the virtual environment:
# pip install -e /vagrant/src/ckan
nosetests --ckan --with-pylons=test-core.ini ckan/tests/controllers/test_package.py:TestActivity -s
No handlers could be found for logger "ckan.lib.uploader"
EEEEEE
======================================================================
ERROR: ckan.tests.controllers.test_package.TestActivity.test_admin_can_see_changes
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/case.py", line 381, in setUp
try_run(self.inst, ('setup', 'setUp'))
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/util.py", line 471, in try_run
return func()
File "/vagrant/src/ckan/ckan/tests/helpers.py", line 214, in setup
reset_db()
File "/vagrant/src/ckan/ckan/tests/helpers.py", line 63, in reset_db
model.repo.rebuild_db()
File "/vagrant/src/ckan/ckan/model/__init__.py", line 229, in rebuild_db
self.delete_all()
File "/vagrant/src/ckan/ckan/model/__init__.py", line 250, in delete_all
connection.execute('delete from "%s"' % table.name)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 939, in execute
return self._execute_text(object, multiparams, params)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1097, in _execute_text
statement, parameters
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
exc_info
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
ProgrammingError: (psycopg2.ProgrammingError) relation "resource_view" does not exist
LINE 1: delete from "resource_view"
^
[SQL: 'delete from "resource_view"']
# fixed by running nosetests again but adding --reset-db parameter:
# nosetests --ckan --with-pylons=test-core.ini ckan/tests/controllers/test_package.py:TestActivity --reset-db
$ nosetests --ckan --with-pylons=test-core.ini ckan/tests/controllers/test_package.py -x
No handlers could be found for logger "ckan.lib.search.common"
E
======================================================================
ERROR: ckan.tests.controllers.test_package.TestActivity.test_add_resource_to_dataset
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/case.py", line 381, in setUp
try_run(self.inst, ('setup', 'setUp'))
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/util.py", line 471, in try_run
return func()
File "/vagrant/src/ckan/ckan/tests/helpers.py", line 217, in setup
search.clear_all()
File "/vagrant/src/ckan/ckan/lib/search/__init__.py", line 247, in clear_all
package_index.clear()
File "/vagrant/src/ckan/ckan/lib/search/index.py", line 89, in clear
clear_index()
File "/vagrant/src/ckan/ckan/lib/search/index.py", line 61, in clear_index
raise SearchIndexError(err)
SearchIndexError: SOLR 'http://127.0.0.1:8983/solr/ckan' exception: SolrError(u'Solr responded with an error (HTTP 404): [Reason: None]\n<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" /><title>Error 404 Not Found</title></head><body><h2>HTTP ERROR 404</h2><p>Problem accessing /solr/ckan/update/. Reason:<pre> Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i> </body></html>',)
----------------------------------------------------------------------
Ran 1 test in 9.121s
FAILED (errors=1)
# fixed by enabling SOLR Multicore - see https://docs.ckan.org/en/latest/contributing/test.html#configure-solr-multi-core
paster serve $CKAN_INI --reload
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 "/vagrant/src/ckan/ckan/config/middleware/__init__.py", line 60, in make_app
flask_app = make_flask_stack(conf, **app_conf)
File "/vagrant/src/ckan/ckan/config/middleware/flask_app.py", line 187, in make_flask_stack
_register_core_blueprints(app)
File "/vagrant/src/ckan/ckan/config/middleware/flask_app.py", line 437, in _register_core_blueprints
module = loader.find_module(name).load_module(name)
File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/vagrant/src/ckan/ckan/views/dataset.py", line 25, in <module>
from ckan.views import LazyView
ImportError: cannot import name LazyView
# Fixed:
# find . -name "*.pyc"|xargs rm
New python executable in /usr/lib/ckan/venv/bin/python2
Also creating executable in /usr/lib/ckan/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module>
Complete output from command /usr/lib/ckan/venv/bin/python2 - setuptools pkg_resources pip wheel:
Collecting setuptools
Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/lib/ckan/venv/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/lib/ckan/venv/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/ckan/venv/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/ckan/venv/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/lib/ckan/venv/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/lib/ckan/venv/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/ckan/venv/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
----------------------------------------
...Installing setuptools, pkg_resources, pip, wheel...done.
main()
File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main
symlink=options.symlink)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 992, in create_environment
download=download,
File "/usr/lib/python3/dist-packages/virtualenv.py", line 922, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 817, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /usr/lib/ckan/venv/bin/python2 - setuptools pkg_resources pip wheel failed with error code 2
# This is due to a network issue when pip tries to download something to install it.
# Fixed by retrying (restart the Travis job).
# https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry
$ ckan db upgrade
No command 'ckan' found, did you mean:
Command 'cpan' from package 'perl' (main)
ckan: command not found
# caused by using git to upgrade CKAN code, but not reinstalling it, which creates the 'ckan' script: /usr/lib/ckan/default/bin/ckan
# fixed by:
# python setup.py develop
$ paster serve /etc/ckan/default/development.ini (Having downgraded CKAN to 2.7)
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 10, 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 "/vagrant/src/ckan/ckan/config/middleware/__init__.py", line 46, in make_app
load_environment(conf, app_conf)
File "/vagrant/src/ckan/ckan/config/environment.py", line 99, in load_environment
p.load_all()
File "/vagrant/src/ckan/ckan/plugins/core.py", line 129, in load_all
unload_all()
File "/vagrant/src/ckan/ckan/plugins/core.py", line 182, in unload_all
unload(*reversed(_PLUGINS))
File "/vagrant/src/ckan/ckan/plugins/core.py", line 210, in unload
plugins_update()
File "/vagrant/src/ckan/ckan/plugins/core.py", line 114, in plugins_update
for env in PluginGlobals.env_registry.values():
AttributeError: type object 'PluginGlobals' has no attribute 'env_registry'
# Fixed by reinstalling pyutilib.component.core:
# pip uninstall pyutilib.component.core
# pip install -r requirements.txt -r dev-requirements.txt
$ ./bin/less
Watching /vagrant/src/ckan/ckan/public/base/less
An error occurred running the less command:
Command failed: `npm bin`/lessc /vagrant/src/ckan/bin/../ckan/public/base/less/main.less > /vagrant/src/ckan/bin/../ckan/public/base/css/main.debug.css
NameError: #grid > .core > .span is undefined in /vagrant/src/ckan/ckan/public/base/vendor/bootstrap/less/navbar.less on line 199, column 3:
198 .navbar-fixed-bottom .container {
199 #grid > .core > .span(@gridColumns);
200 }
# Not sure why this doesn't compile.
# Fixed by removing the relevant lines in ckan/public/base/vendor/bootstrap/less/navbar.less:
-// Reset container width
-// Required here as we reset the width earlier on and the grid mixins don't override early enough
-.navbar-static-top .container,
-.navbar-fixed-top .container,
-.navbar-fixed-bottom .container {
- #grid > .core > .span(@gridColumns);
-}
$ paster --plugin=ckan datastore set-permissions -c test-core.ini
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 10, in <module>
sys.exit(run())
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 101, in run
command = commands[command_name].load()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2305, in load
return self.resolve()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2315, in resolve
raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'SetupDatastoreCommand'
# error occurs after upgrading CKAN
# Fixed by reinstalling ckan module:
# pip install -e .
File "/vagrant/src/ckan/ckan/plugins/core.py", line 115, in plugins_update
for env in PluginGlobals.env.values():
AttributeError: 'function' object has no attribute 'values'
# Wrong version of pyutilib
# Fixed by:
cd ../ckan
pip uninstall pyutilib pyutilib.component.core
pip install -r requirements.txt
File "/vagrant/src/ckan/ckan/plugins/core.py", line 115, in plugins_update
for env in PluginGlobals.env_registry.values():
AttributeError: type object 'PluginGlobals' has no attribute 'env_registry'
# Wrong version of pyutilib
# Fixed by:
cd ../ckan
pip uninstall pyutilib pyutilib.component.core
pip install -r requirements.txt
File "/vagrant/src/ckan/ckan/plugins/core.py", line 10, in <module>
from pyutilib.component.core import PluginGlobals, implements
ImportError: No module named core
# Wrong version of pyutilib
# Fixed by:
cd ../ckan
pip uninstall pyutilib pyutilib.component.core
pip install -r requirements.txt
(default) ubuntu@ubuntu-xenial:/vagrant/src/ckanext-xloader$ nosetests --nologcapture --with-pylons=test.ini -x
/usr/lib/ckan/default/local/lib/python2.7/site-packages/webassets/loaders.py:162: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
obj = self.yaml.load(f) or {}
No handlers could be found for logger "ckan.lib.search.common"
E
======================================================================
ERROR: ckanext.xloader.tests.test_action.TestAction.test_duplicated_submits
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/vagrant/src/ckanext-xloader/ckanext/xloader/tests/test_action.py", line 57, in test_duplicated_submits
res = factories.Resource(user=user, format='csv')
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/base.py", line 80, in __call__
return cls.create(**kwargs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/base.py", line 452, in create
attrs = cls.attributes(create=True, extra=kwargs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/base.py", line 316, in attributes
force_sequence=force_sequence,
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/containers.py", line 281, in build
return stub.__fill__()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/containers.py", line 83, in __fill__
res[attr] = getattr(self, attr)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/containers.py", line 105, in __getattr__
val = val.evaluate(self, self.__containers)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/containers.py", line 214, in evaluate
containers=containers,
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/declarations.py", line 75, in evaluate
return self.function(obj)
File "/vagrant/src/ckan/ckan/tests/factories.py", line 147, in <lambda>
package_id = factory.LazyAttribute(lambda _: Dataset()['id'])
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/base.py", line 80, in __call__
return cls.create(**kwargs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/base.py", line 453, in create
return cls._generate(True, attrs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/base.py", line 378, in _generate
obj = cls._prepare(create, **attrs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/factory/base.py", line 358, in _prepare
return cls._create(target_class, *args, **kwargs)
File "/vagrant/src/ckan/ckan/tests/factories.py", line 336, in _create
**kwargs)
File "/vagrant/src/ckan/ckan/tests/helpers.py", line 106, in call_action
return logic.get_action(action_name)(context=context, data_dict=kwargs)
File "/vagrant/src/ckan/ckan/logic/__init__.py", line 466, in wrapped
result = _action(context, data_dict, **kw)
File "/vagrant/src/ckan/ckan/logic/action/create.py", line 229, in package_create
model.repo.commit()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 162, in do
return getattr(self.registry(), name)(*args, **kwargs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1027, in commit
self.transaction.commit()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 494, in commit
self._prepare_impl()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 462, in _prepare_impl
self.session.dispatch.before_commit(self.session)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/event/attr.py", line 297, in __call__
fn(*args, **kw)
File "/vagrant/src/ckan/ckan/model/extension.py", line 107, in before_commit
methodcaller('before_commit', session)
File "/vagrant/src/ckan/ckan/model/extension.py", line 88, in notify_observers
func(observer)
File "/vagrant/src/ckan/ckan/model/modification.py", line 33, in before_commit
self.notify_observers(session, self.notify)
File "/vagrant/src/ckan/ckan/model/modification.py", line 50, in notify_observers
method(obj, domain_object.DomainObjectOperation.new)
File "/vagrant/src/ckan/ckan/model/modification.py", line 91, in notify
model.Session.expunge(g.userobj)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/werkzeug/local.py", line 348, in __getattr__
return getattr(self._get_current_object(), name)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/registry.py", line 137, in __getattr__
return getattr(self._current_obj(), attr)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/registry.py", line 197, in _current_obj
'thread' % self.____name__)
TypeError: No object (name: tmpl_context or C) has been registered for this thread
# Solr was not ready. Fixed by restarting Solr:
# sudo service jetty8 restart
pytest --ckan-ini=test-core.ini ckan/tests/lib/test_mailer.py
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/pytest", line 10, in <module>
sys.exit(main())
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 63, in main
config = _prepareconfig(args, plugins)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 207, in _prepareconfig
pluginmanager=pluginmanager, args=args
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/manager.py", line 87, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/callers.py", line 203, in _multicall
gen.send(outcome)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/helpconfig.py", line 94, in pytest_cmdline_parse
config = outcome.get_result()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/callers.py", line 81, in get_result
_reraise(*ex) # noqa
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 687, in pytest_cmdline_parse
self.parse(args)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 895, in parse
self._preparse(args, addopts=addopts)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 851, in _preparse
early_config=self, args=args, parser=self._parser
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/manager.py", line 87, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/callers.py", line 81, in get_result
_reraise(*ex) # noqa
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 750, in pytest_load_initial_conftests
self.pluginmanager._set_initial_conftests(early_config.known_args_namespace)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 383, in _set_initial_conftests
self._try_load_conftest(anchor)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 389, in _try_load_conftest
self._getconftestmodules(anchor)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 424, in _getconftestmodules
mod = self._importconftest(conftestpath.realpath())
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 474, in _importconftest
self.consider_conftest(mod)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 527, in consider_conftest
self.register(conftestmodule, name=conftestmodule.__file__)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 328, in register
self.consider_module(plugin)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 533, in consider_module
self._import_plugin_specs(getattr(mod, "pytest_plugins", []))
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 538, in _import_plugin_specs
self.import_plugin(import_spec)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 574, in import_plugin
six.reraise(ImportError, new_exc, tb)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 565, in import_plugin
__import__(importspec)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/_pytest/assertion/rewrite.py", line 304, in load_module
exec(co, mod.__dict__)
File "/vagrant/src/ckan/ckan/tests/pytest_ckan/ckan_setup.py", line 5, in <module>
from ckan.config.middleware import make_app
File "/vagrant/src/ckan/ckan/config/middleware/__init__.py", line 10, in <module>
from ckan.lib.i18n import get_locales_from_config
File "/vagrant/src/ckan/ckan/lib/i18n.py", line 53, in <module>
from ckan.common import config, is_flask_request, aslist
File "/vagrant/src/ckan/ckan/common.py", line 24, in <module>
import pylons
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/__init__.py", line 4, in <module>
from pylons.config import config
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/config.py", line 2, in <module>
from pylons.configuration import *
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/configuration.py", line 25, in <module>
import pylons.legacy
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/legacy.py", line 9, in <module>
import pylons.decorators
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/decorators/__init__.py", line 17, in <module>
from webob import UnicodeMultiDict
ImportError: Error importing plugin "ckan.tests.pytest_ckan.ckan_setup": cannot import name UnicodeMultiDict
# You have an incompatibility between pylons and the version of webob (e.g. webob==1.8.5). This is probably due to running under python2 and installing requirements.txt (designed for python3).
# To fix, either:
# run it with a virtualenv created with python3
# or:
# pip install -r requirements-py2.txt
$ nosetests --nologcapture --with-pylons=test-core.ini ckan/tests -x
No handlers could be found for logger "ckan.lib.uploader"
E
======================================================================
ERROR: After build, there are some folders with assets inside
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
TypeError: test_build_and_clean() takes exactly 4 arguments (0 given)
# These test arguments are magically added by pytest, and the problem is you can't run these tests with nosetests any longer. See: https://docs.pytest.org/en/latest/fixture.html#fixtures-as-function-arguments
# Fix by switching to a virtualenv with python3, reinstall the requirements and test with pytest
pip install -r requirements.txt -r dev-requirements.txt
Requirement already satisfied: alembic==1.0.0 in ./venv3/lib/python3.5/site-packages (from -r requirements.txt (line 7)) (1.0.0)
Requirement already satisfied: babel==2.3.4 in ./venv3/lib/python3.5/site-packages (from -r requirements.txt (line 8)) (2.3.4)
Requirement already satisfied: beaker==1.11.0 in ./venv3/lib/python3.5/site-packages (from -r requirements.txt (line 9)) (1.11.0)
Requirement already satisfied: bleach==3.0.2 in ./venv3/lib/python3.5/site-packages (from -r requirements.txt (line 10)) (3.0.2)
Collecting certifi==2019.11.28
Using cached https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl
Requirement already satisfied: chardet==3.0.4 in ./venv3/lib/python3.5/site-packages (from -r requirements.txt (line 12)) (3.0.4)
Requirement already satisfied: click==6.7 in ./venv3/lib/python3.5/site-packages (from -r requirements.txt (line 13)) (6.7)
Requirement already satisfied: decorator==4.4.1 in ./venv3/lib/python3.5/site-packages (from -r requirements.txt (line 14)) (4.4.1)
ERROR: Exception:
Traceback (most recent call last):
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
status = self.run(options, args)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_internal/commands/install.py", line 382, in run
resolver.resolve(requirement_set)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_internal/legacy_resolve.py", line 202, in resolve
self._resolve_one(requirement_set, req)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_internal/legacy_resolve.py", line 366, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_internal/legacy_resolve.py", line 302, in _get_abstract_dist_for
skip_reason = self._check_skip_installed(req)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_internal/legacy_resolve.py", line 254, in _check_skip_installed
req_to_install.check_if_exists(self.use_user_site)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_internal/req/req_install.py", line 441, in check_if_exists
self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 482, in get_distribution
dist = get_provider(dist)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 358, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 774, in resolve
env = Environment(self.entries)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 985, in __init__
self.scan(search_path)
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1017, in scan
for dist in find_distributions(item):
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2066, in find_on_path
for dist in factory(fullpath):
File "/vagrant/src/ckan/venv3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2162, in resolve_egg_link
return next(dist_groups, ())
TypeError: 'list' object is not an iterator
# fixed with:
pip install --upgrade pip
# upgrades it from 19.3.1->20.0.2
pip install -r requirements.txt -r dev-requirements.txt
...
Installing collected packages: certifi, dominate, webob, shutilwhich, fanstatic, lxml, feedgen, flask-multistatic, funcsigs, pbr, urllib3, Sphinx, pytest, pytest-split-tests, pytest-cov
Attempting uninstall: certifi
Found existing installation: certifi 2019.9.11
Uninstalling certifi-2019.9.11:
Successfully uninstalled certifi-2019.9.11
ERROR: Could not install packages due to an EnvironmentError: [Errno 39] Directory not empty: '__pycache__'
# fixed with:
find . -name "__pycache__" |xargs rm -r
$ pytest --ckan-ini=test-core.ini ckanext/example_idatastorebackend/test/test_plugin.py -k test_backend_functionality
Please specify a ckan.storage_path in your config
for your uploads
============================================================================== test session starts ===============================================================================
platform linux -- Python 3.6.9, pytest-4.6.5, py-1.8.1, pluggy-0.13.1
rootdir: /vagrant/src/ckan, inifile: setup.cfg
plugins: split-tests-1.0.9, rerunfailures-8.0, pyfakefs-3.2, cov-2.7.1
collected 0 items / 1 errors
===================================================================================== ERRORS =====================================================================================
_____________________________________________________ ERROR collecting ckanext/example_idatastorebackend/test/test_plugin.py _____________________________________________________
import file mismatch:
imported module 'ckanext.example_idatastorebackend.test.test_plugin' has this __file__ attribute:
/usr/lib/ckan/default/src/ckan/ckanext/example_idatastorebackend/test/test_plugin.py
which is not the same as the test file we want to collect:
/vagrant/src/ckan/ckanext/example_idatastorebackend/test/test_plugin.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 1 error in 0.55 seconds =============================================================================
# Fixed with:
find . -name "*.pyc" -delete; find . -name "__pycache__" |xargs rm -rf
pytest --ckan-ini=test-core.ini /usr/lib/ckan/default/src/ckan/ckanext/example_idatastorebackend/test/test_plugin.py
mod_wsgi (pid=2808): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
Traceback (most recent call last):
File "/etc/ckan/default/apache.wsgi", line 9, in <module>
application = loadapp('config:%s' % config_filepath)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 253, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 278, in loadobj
return context.create()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 715, in create
return self.object_type.invoke(self)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 152, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/util.py", line 58, in fix_call
reraise(*exc_info)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/compat.py", line 23, in reraise
exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
val = callable(*args, **kw)
TypeError: make_app() got an unexpected keyword argument 'ckan.preview.loadable'
# This is because of using an old apache.wsgi file. It needs updating for CKAN 2.9 to use werkzeug instead of paste.deploy.
# See: https://github.com/ckan/ckan/issues/4802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment