Kallithea issues archive

Issue #345: [doc] Posgres initialization failes with "Please check that the keyword arguments..."

Reported by: Shukri Adams
State: resolved
Created on: 2019-08-26 09:30
Updated on: 2020-06-18 19:48

Description

I’m trying to set up a docker container of Kallithea 0.4.1 running against Postgres 12. Initialization fails with the following ouput

root@e849433575ed:/# kallithea-cli db-create -c /opt/kallithea/production.ini --user=admin --email=admin@admin.com --password=MYPASSWORD --repos=/opt/kallithea/repos
2019-08-26 09:16:41.872 INFO [kallithea.model.base] initializing db for postgres://kallithea:XXXXX@127.0.0.1:5432/kallithea
2019-08-26 09:16:41.873 INFO [kallithea.lib.db_manage] Any existing database is going to be destroyed
Are you sure to destroy old database ? [y/n]y
2019-08-26 09:16:44.095 INFO [kallithea.lib.db_manage] Created tables for kallithea
2019-08-26 09:16:44.095 INFO [kallithea.lib.db_manage] Setting up repositories config
2019-08-26 09:16:44.178 INFO [kallithea.lib.db_manage] created ui config
2019-08-26 09:16:44.179 INFO [kallithea.lib.db_manage] creating default user
2019-08-26 09:16:44.265 INFO [kallithea.lib.db_manage] creating user admin
2019-08-26 09:16:44.337 INFO [kallithea.lib.db_manage] creating permissions
2019-08-26 09:16:44.390 INFO [kallithea.lib.db_manage] creating default user permissions
Traceback (most recent call last):
File "/usr/local/bin/kallithea-cli", line 10, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/kallithea/bin/kallithea_cli_base.py", line 52, in runtime_wrapper
return annotated(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/kallithea/bin/kallithea_cli_db.py", line 70, in db_create
kallithea.CONFIG.global_conf, **kallithea.CONFIG.local_conf)
File "/usr/local/lib/python2.7/dist-packages/kallithea/config/middleware.py", line 29, in make_app_without_logging
return make_base_app(global_conf, full_stack=full_stack, **app_conf)
File "/usr/local/lib/python2.7/dist-packages/tg/configuration/app_config.py", line 1225, in make_base_app
app_config = load_environment(global_conf, app_conf)
File "/usr/local/lib/python2.7/dist-packages/tg/configuration/app_config.py", line 921, in load_environment
self._setup_persistence(app_config)
File "/usr/local/lib/python2.7/dist-packages/tg/configuration/app_config.py", line 689, in _setup_persistence
self._setup_sqlalchemy(conf)
File "/usr/local/lib/python2.7/dist-packages/tg/configuration/app_config.py", line 784, in _setup_sqlalchemy
engine = engine_from_config(conf, 'sqlalchemy.')
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/init.py", line 486, in engine_from_config
return create_engine(url, **options)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/init.py", line 443, in create_engine
return strategy.create(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 172, in create
engineclass.name,
TypeError: Invalid argument(s) 'db1.pool_recycle','db1.echo','db1.convert_unicode' sent to create_engine(), using configuration PGDialect_psycopg2/QueuePool/Engine. Please check that the keyword arguments are appropriate for this combination of components.

I can’t find any information on this error elsewhere I’m afraid.

Attachments

Comments

Comment by Mads Kiilerich, on 2019-08-26 10:48

It seems like the .ini file is outdated. Have you just created it?

Kallithea 0.4 contained https://kallithea-scm.org/repos/kallithea/changeset/f973b866fffc as a part of the porting to TurboGears.

If you are upgrading an existing installation, we suggest creating a new .ini file and manually re-apply the settings that are important to you.

Comment by Shukri Adams, on 2019-08-26 12:15

I created a new ini file from 0.4.3. Now when I try to initialize the db I get

Initializing Kallithea
2019-08-26 12:05:38.360 ERROR [kallithea.config.app_cfg] Cannot encode Unicode paths to file system encoding 'ANSI_X3.4-1968'
2019-08-26 12:05:38.360 ERROR [kallithea.config.app_cfg] Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'
2019-08-26 12:05:38.360 ERROR [kallithea.config.app_cfg] Terminating ...
Are you sure to destroy old database ? [y/n]Running 'npm install' to install front-end dependencies from package.json
Traceback (most recent call last):
File "/usr/local/bin/kallithea-cli", line 10, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/kallithea/bin/kallithea_cli_front_end.py", line 45, in front_end_build
subprocess.check_call(['npm', 'install'], cwd=front_end_dir, shell=kallithea.is_windows)
File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 172, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 394, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
2019-08-26 12:05:39.691 ERROR [kallithea.config.app_cfg] Cannot encode Unicode paths to file system encoding 'ANSI_X3.4-1968'
2019-08-26 12:05:39.691 ERROR [kallithea.config.app_cfg] Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'
2019-08-26 12:05:39.691 ERROR [kallithea.config.app_cfg] Terminating ...
2019-08-26 12:05:41.105 ERROR [kallithea.config.app_cfg] Cannot encode Unicode paths to file system encoding 'ANSI_X3.4-1968'
2019-08-26 12:05:41.105 ERROR [kallithea.config.app_cfg] Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'
2019-08-26 12:05:41.106 ERROR [kallithea.config.app_cfg] Terminating ...
2019-08-26 12:05:42.659 ERROR [kallithea.config.app_cfg] Cannot encode Unicode paths to file system encoding 'ANSI_X3.4-1968'
2019-08-26 12:05:42.660 ERROR [kallithea.config.app_cfg] Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'
2019-08-26 12:05:42.660 ERROR [kallithea.config.app_cfg] Terminating ...
2019-08-26 12:05:44.399 ERROR [kallithea.config.app_cfg] Cannot encode Unicode paths to file system encoding 'ANSI_X3.4-1968'
2019-08-26 12:05:44.399 ERROR [kallithea.config.app_cfg] Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'
2019-08-26 12:05:44.399 ERROR [kallithea.config.app_cfg] Terminating ...
2019-08-26 12:05:46.878 ERROR [kallithea.config.app_cfg] Cannot encode Unicode paths to file system encoding 'ANSI_X3.4-1968'
2019-08-26 12:05:46.879 ERROR [kallithea.config.app_cfg] Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'
2019-08-26 12:05:46.879 ERROR [kallithea.config.app_cfg] Terminating ...
2019-08-26 12:05:49.787 ERROR [kallithea.config.app_cfg] Cannot encode Unicode paths to file system encoding 'ANSI_X3.4-1968'
2019-08-26 12:05:49.787 ERROR [kallithea.config.app_cfg] Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'
2019-08-26 12:05:49.787 ERROR [kallithea.config.app_cfg] Terminating ...

Two additional small things :

  • the setup documentation don’t mention that nodejs is required, I installed 10.x.
  • I initially tried running off a dockerized Postgress @ version “12-alpine”, but the Kallithea initializer failed with an error that it couldn’t determine Postgres version from string, so I fell back to “9.6.14”, I assumed it was a semver parse error.

I found the installation of 0.4 to be somewhat painful and I don’t have time to box with it, falling back to 0.3 (which was a pretty easy install in comparison). Hopefully this feedback was useful.

Comment by Mads Kiilerich, on 2019-08-26 13:17

FWIW, there is no 0.4.3 yet.

https://kallithea.readthedocs.io/en/stable/overview.html says “The tool npm is used to download external dependencies and orchestrate the processing. The npm binary must thus be available.” … but you are right, we should probably make that more prominent. Thanks for the feedback.

The way a prompt is hidden in your output suggest that some of your problems might be due to your automation that make assumptions that no longer are valid with 0.4 . Your automation seems to continue after the first error, thus obfuscating what is going on.

Kallithea also detects a fundamental problem in the locale setup in the environment Kallithea is run in. Kallithea cannot run in an environment that only knows about 7-bit ASCII. The advice about setting LC_CTYPE should solve it.

I am not aware of Kallithea parsing PostgreSQL versions anywhere. But we depend on sqlalchemy that might do it. The exact error might lead to a bug report and fix/workaround on sqlalchemy (or psycopg2).