lightningd / plugins

Community curated plugins for core-lightning
BSD 3-Clause "New" or "Revised" License
269 stars 129 forks source link

Backup plugin unable to install/start #389

Open carboncls opened 2 years ago

carboncls commented 2 years ago

On Ubuntu 22.04, when I try poetry install, I get this error:

~/plugins/backup$ poetry install
Installing dependencies from lock file

Package operations: 4 installs, 0 updates, 0 removals

  • Installing psycopg2-binary (2.8.6): Failed

  EnvCommandError

  Command ['/home/carlo/.cache/pypoetry/virtualenvs/cln-backup-z06fb3to-py3.10/bin/pip', 'install', '--no-deps', 'file:///home/carlo/.cache/pypoetry/artifacts/3b/c2/db/b2803088b8f1c9e517ec4b163c4d49032a6d3bb428921040baa301f506/psycopg2-binary-2.8.6.tar.gz'] errored with the following return code 1, and output: 
  Processing /home/carlo/.cache/pypoetry/artifacts/3b/c2/db/b2803088b8f1c9e517ec4b163c4d49032a6d3bb428921040baa301f506/psycopg2-binary-2.8.6.tar.gz
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'error'
    error: subprocess-exited-with-error

    × python setup.py egg_info did not run successfully.
    │ exit code: 1
    ╰─> [25 lines of output]
        /home/carlo/.cache/pypoetry/virtualenvs/cln-backup-z06fb3to-py3.10/lib/python3.10/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
          warnings.warn(msg, warning_class)
        running egg_info
        creating /tmp/pip-pip-egg-info-b9a2s426/psycopg2_binary.egg-info
        writing /tmp/pip-pip-egg-info-b9a2s426/psycopg2_binary.egg-info/PKG-INFO
        writing dependency_links to /tmp/pip-pip-egg-info-b9a2s426/psycopg2_binary.egg-info/dependency_links.txt
        writing top-level names to /tmp/pip-pip-egg-info-b9a2s426/psycopg2_binary.egg-info/top_level.txt
        writing manifest file '/tmp/pip-pip-egg-info-b9a2s426/psycopg2_binary.egg-info/SOURCES.txt'

        Error: pg_config executable not found.

        pg_config is required to build psycopg2 from source.  Please add the directory
        containing pg_config to the $PATH or specify the full executable path with the
        option:

            python setup.py build_ext --pg-config /path/to/pg_config build ...

        or with the pg_config option in 'setup.cfg'.

        If you prefer to avoid building psycopg2 from source, please install the PyPI
        'psycopg2-binary' package instead.

        For further information please check the 'doc/src/install.rst' file (also at
        <https://www.psycopg.org/docs/install.html>).

        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: metadata-generation-failed

  × Encountered error while generating package metadata.
  ╰─> See above for output.

  note: This is an issue with the package mentioned above, not pip.
  hint: See above for details.

  at ~/.local/lib/python3.10/site-packages/poetry/utils/env.py:1195 in _run
      1191│                 output = subprocess.check_output(
      1192│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1193│                 )
      1194│         except CalledProcessError as e:
    → 1195│             raise EnvCommandError(e, input=input_)
      1196│ 
      1197│         return decode(output)
      1198│ 
      1199│     def execute(self, bin, *args, **kwargs):

When I want to install the psycopg2-binary, I get:

pip install psycopg2-binary
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: psycopg2-binary in ./.local/lib/python3.10/site-packages (2.9.3)

Not sure if I'm doing something wrong, or if it's a problem with poetry.

carboncls commented 2 years ago

Ok, I needed to also install libpq-dev with sudo apt install libpq-dev. Now, pip install psycopg2 worked, and then from the backup dir, poetry install finished without error.

carboncls commented 2 years ago

lightningd won't start though:

Traceback (most recent call last):
  File "/home/carlo/plugins/backup/backup.py", line 10, in <module>
    from backend import Change
  File "/home/carlo/plugins/backup/backend.py", line 7, in <module>
    from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'
lightningd: lightningd/plugin.c:1795: plugins_init: Assertion `ret == plugins' failed.
lightningd: FATAL SIGNAL 6 (version v0.12.0)
0x55da863236b5 send_backtrace
    common/daemon.c:33
0x55da8632374c crashdump
    common/daemon.c:46
0x7fdadeebf51f ???
    ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fdadef13a7c __pthread_kill_implementation
    ./nptl/pthread_kill.c:44
0x7fdadef13a7c __pthread_kill_internal
    ./nptl/pthread_kill.c:78
0x7fdadef13a7c __GI___pthread_kill
    ./nptl/pthread_kill.c:89
0x7fdadeebf475 __GI_raise
    ../sysdeps/posix/raise.c:26
0x7fdadeea57f2 __GI_abort
    ./stdlib/abort.c:79
0x7fdadeea571a __assert_fail_base
    ./assert/assert.c:92
0x7fdadeeb6e95 __GI___assert_fail
    ./assert/assert.c:101
0x55da8630046c plugins_init
    lightningd/plugin.c:1795
0x55da862e0e76 main
    lightningd/lightningd.c:982
0x7fdadeea6d8f __libc_start_call_main
    ../sysdeps/nptl/libc_start_call_main.h:58
0x7fdadeea6e3f __libc_start_main_impl
    ../csu/libc-start.c:392
0x55da862c3c44 ???
    ???:0
0xffffffffffffffff ???
    ???:0
lightningd: Died with signal 6
carboncls commented 2 years ago

after pip install tqdm, lightningd did start and the plugin is working!

there might need to be additional things for poetry install to do.