cryptosharks131 / lndg

Lite GUI web interface to analyze lnd data and leverage the backend database for automation tools around rebalancing and other basic maintenance tasks.
MIT License
231 stars 47 forks source link

LNDg cannot start using django v5.0+ #353

Closed teemie1 closed 10 months ago

teemie1 commented 11 months ago

I found the following error after successfully setup all steps

$ .venv/bin/python manage.py runserver 0.0.0.0:8889 Performing system checks...

Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 953, in run self._target(*self._args, *self._kwargs) File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper fn(args, **kwargs) File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 133, in inner_run self.check(display_num_errors=True) File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/core/management/base.py", line 485, in check all_issues = checks.run_checks( File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver return check_method() File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/urls/resolvers.py", line 516, in check for pattern in self.url_patterns: File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/utils/functional.py", line 47, in get res = instance.dict[self.name] = self.func(instance) File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/urls/resolvers.py", line 735, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/utils/functional.py", line 47, in get res = instance.dict[self.name] = self.func(instance) File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/urls/resolvers.py", line 728, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/home/lndg/lndg/lndg/urls.py", line 22, in path('', include('gui.urls')), File "/home/lndg/lndg/.venv/lib/python3.10/site-packages/django/urls/conf.py", line 38, in include urlconf_module = import_module(urlconf_module) File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/home/lndg/lndg/gui/urls.py", line 4, in from . import views File "/home/lndg/lndg/gui/views.py", line 12, in from .forms import OpenChannelForm, CloseChannelForm, ConnectPeerForm, AddInvoiceForm, RebalancerForm, UpdateChannel, UpdateSetting, LocalSettingsForm, AddTowerForm, RemoveTowerForm, DeleteTowerForm, BatchOpenForm, UpdatePending, UpdateClosing, UpdateKeysend, AddAvoid, RemoveAvoid File "/home/lndg/lndg/gui/forms.py", line 9, in class RebalancerModelChoiceField(forms.models.ModelMultipleChoiceField): File "/home/lndg/lndg/gui/forms.py", line 15, in RebalancerModelChoiceField forms.MultipleChoiceField._set_choices) AttributeError: type object 'MultipleChoiceField' has no attribute '_set_choices' $ `

My environment: Bitcoin Core 26.0 LND 0.17.3 OS: Ubuntu 22.04.3 $ lncli -v lncli version 0.17.3-beta commit=v0.17.3-beta

$ bitcoin-cli --version Bitcoin Core RPC client version v26.0.0 Copyright (C) 2009-2023 The Bitcoin Core developers

Please contribute if you find Bitcoin Core useful. Visit https://bitcoincore.org/ for further information about the software. The source code is available from https://github.com/bitcoin/bitcoin.

This is experimental software. Distributed under the MIT software license, see the accompanying file COPYING or https://opensource.org/licenses/MIT $ cat /etc/os-release PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy `

lacksfish commented 11 months ago

In the requirements.txt file, do the following change: Replace Django with Django==4.2.8

Then, re-run venv/bin/pip install -r requirements.txt (or wherever your venv is)

Django released v5 a few days ago which handles form choices a bit different (thus breaking things) and the requirements.txt would try to install the latest v5. If you rollback to Django v4 your problem will go away :)

cryptosharks131 commented 11 months ago

Thanks @lacksfish for the root cause and interim fix! This issue will be resolved in the v1.8.0 release.

lacksfish commented 11 months ago

I see https://github.com/cryptosharks131/lndg/commit/fedef6d9199c6d5404f9af379331663426c36985 👍

OT: I have this running for about a good week now. Autofee seems to be working and adjusts every now and then. I have AR enabled as well as under 'Advanced Settings' I manually enabled AR for all my channels. Some have been immediately disabled by AR again. I think that's expected? Still, my channels are not really balanced, either completely full or completely empty.

Does this sound like it's working ? I'd love to route more payments, but not much is happening. Perhaps my channels are not good (directional-bias, etc) ?

cryptosharks131 commented 11 months ago

You don't want to enable all individual channels for AR, only the ones you want to invest sats into restocking the outbound liquidity for (so you can resell it at a higher price). All channels that are not marked for AR will be potential sources to refill those selected channels. The Autopilot feature will enable and disable channels based on their historical flow rates, so it's possible this is why you saw this behavior.

This guide can help understanding the process a bit better as well. https://github.com/cryptosharks131/lndg/blob/master/quickstart.md

teemie1 commented 11 months ago

Successfully started lndg after changed Django==4.2.8. Thank you very much.

microlancer commented 11 months ago

Just a hint for people using docker, you can change the Dockerfile to pick up your change to requirements.txt by adding a COPY line like this:

04:37 $ cat Dockerfile 
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN git clone https://github.com/cryptosharks131/lndg.git /lndg
WORKDIR /lndg
COPY requirements.txt /lndg/requirements.txt
RUN pip install -r requirements.txt
RUN pip install supervisor whitenoise

And then re-run docker-compose build --no-cache to make a new image and try it again. I also deleted the lndg container and lndg image for good measure before running docker-compose up again.