MontrealCorpusTools / Montreal-Forced-Aligner

Command line utility for forced alignment using Kaldi
https://montrealcorpustools.github.io/Montreal-Forced-Aligner/
MIT License
1.34k stars 246 forks source link

[BUG] MFA doesn't work in docker system with 'createdb' error #585

Closed orantake closed 1 year ago

orantake commented 1 year ago

Hi, Im using Montreal Forced Aligner in docker system, but in all commands, such as validate, align, train, it evokes same error message with "createdb".

 WARNING  The previous run had a different configuration than the current, which may cause issues. Please see the log for details or use --clean flag if issues are encountered.        
 ERROR    There was an error connecting to the global MFA database server.                                                                                                              
 ERROR    Please ensure the server is initialized (mfa server init) or running (mfa server start)                                                                                       
 ERROR    There was an error in the run, please see the log.                                                                                                                            
Exception ignored in atexit callback: <bound method ExitHooks.history_save_handler of <montreal_forced_aligner.command_line.mfa.ExitHooks object at 0x7fe293536f50>>
Traceback (most recent call last):
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/command_line/mfa.py", line 97, in history_save_handler
    raise self.exception
  File "/root/miniconda3/envs/aligner/bin/mfa", line 11, in <module>
    sys.exit(mfa_cli())
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/rich_click/rich_group.py", line 21, in main
    rv = super().main(*args, standalone_mode=False, **kwargs)
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/command_line/validate.py", line 113, in validate_corpus_cli
    validator.validate()
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/validation/corpus_validator.py", line 595, in validate
    self.setup()
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/validation/corpus_validator.py", line 539, in setup
    self.initialize_database()
  File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/abc.py", line 241, in initialize_database
    subprocess.check_call(
  File "/root/miniconda3/envs/aligner/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['createdb', '--host=/root/Documents/MFA/pg_mfa_global_socket', 'kss']' returned non-zero exit status 1.
mmcauliffe commented 1 year ago

Can you run mfa configure --enable_auto_server and see if that fixes it?

orantake commented 1 year ago

Now it causes another error with "initdb"

The global MFA database server does not exist, initializing it first. There was an issue initializing the server, please refer to /root/Documents/MFA/pg_init_log_global.txt for more details Traceback (most recent call last): File "/root/miniconda3/envs/aligner/bin/mfa", line 11, in <module> sys.exit(mfa_cli()) File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/rich_click/rich_group.py", line 21, in main rv = super().main(*args, standalone_mode=False, **kwargs) File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1654, in invoke super().invoke(ctx) File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/command_line/mfa.py", line 127, in mfa_cli start_server() File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/command_line/utils.py", line 353, in start_server initialize_server() File "/root/miniconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/command_line/utils.py", line 313, in initialize_server subprocess.check_call( File "/root/miniconda3/envs/aligner/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['initdb', '-D', PosixPath('/root/Documents/MFA/pg_mfa_global'), '--encoding=UTF8']' returned non-zero exit status 1.

OpeyemiOsakuade commented 1 year ago

Any solution yet? I also have this issue @mmcauliffe @orantake

mmcauliffe commented 1 year ago

Ok, so there should be new docker images with a pre-initialized global postgresql server now, so that should fix this issue. I've updated the entry point for the docker image so that docker run montreal-forced-aligner align/g2p/etc work, but I'm not a regular docker user so if you could test out the new image and let me know if there are issues, I would appreciate it!