C-Otto / rebalance-lnd

A script that can be used to balance lightning channels of a lnd node
MIT License
343 stars 82 forks source link

failed installation on Raspiblitz 1.8 - followed the Raspibolt installation guide #302

Closed maximlomans closed 1 year ago

maximlomans commented 1 year ago

first glitch was with; $ sudo adduser rebalance-lnd lnd which outputs: no lnd user nor group

yet in docs it clearly states - we re adding rebalance-lnd to "bitcoin" group -with access to lnd ;there is a bitcoin group on raspiblitz but no lnd -

i then did bitcoin and it ran

$ pip install -r require;ents.txt failed with;

Installing collected packages: zipp, rebalance-lnd, protobuf, grpcio, importlib-resources, googleapis-common-protos, yachalk WARNING: The script rebalance-lnd is installed in '/home/rebalance-lnd/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed googleapis-common-protos-1.57.0 grpcio-1.51.1 importlib-resources-5.10.0 protobuf-3.20.2 rebalance-lnd-2.3 yachalk-0.1.5 zipp-3.11.0 --- Logging error --- Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/pip/_internal/utils/logging.py", line 177, in emit self.console.print(renderable, overflow="ignore", crop=False, style=style) File "/usr/local/lib/python3.9/dist-packages/pip/_vendor/rich/console.py", line 1752, in print extend(render(renderable, render_options)) File "/usr/local/lib/python3.9/dist-packages/pip/_vendor/rich/console.py", line 1390, in render for render_output in iter_render: File "/usr/local/lib/python3.9/dist-packages/pip/_internal/utils/logging.py", line 134, in rich_console

in the Raspibold debian setup guide the path addition comes after running pip install as in;

"Add the rebalance-lnd binary file location to PATH "

$ echo 'export PATH=$PATH:/home/rebalance-lnd/rebalance-lnd' >> /home/rebalance-lnd/.bashrc $ source /home/rebalance-lnd/.bashrc

to be clear, i did add path and ran the installation again but got the same error. I then tried instlling in the admin's home directory

and to my surprise the same error occured again . am i missing something ?

I then installed lightning terminal from raspiblitz services tab to loop, it installed and works fine - but noticed that lit was now the owner of rebalance-lnd - with rebalance-lnd as group .

I had it running on raspiblitz 1.7.2 without issues, and without its own user & home dir -instead in the admins dir .

what going on ?

b.t.w Otto - on my book you 're still King. ; ) voila, and that's the whole thing

C-Otto commented 1 year ago

This seems to be related to the Raspibolt installation guide, which I don't know. Please file the issue there.

maximlomans commented 1 year ago

I got it sorted created the rebalance-lnd user nd installed it through virtualenv + pip3

:~/rebalance/rebalance-lnd $ pip3 install -r requirements.txt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting googleapis-common-protos==1.57.0 Downloading https://www.piwheels.org/simple/googleapis-common-protos/googleapis_common_protos-1.57.0-py2.py3-none-any.whl (217 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 218.0/218.0 kB 1.5 MB/s eta 0:00:00 Collecting grpcio==1.51.1 Downloading grpcio-1.51.1-cp39-cp39-manylinux_2_17_aarch64.whl (71.5 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 71.5/71.5 MB 1.4 MB/s eta 0:00:00 Collecting protobuf==3.20.2 Downloading protobuf-3.20.2-cp39-cp39-manylinux2014_aarch64.whl (918 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 918.4/918.4 kB 2.0 MB/s eta 0:00:00 Collecting six==1.16.0 Downloading https://www.piwheels.org/simple/six/six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting yachalk==0.1.5 Downloading https://www.piwheels.org/simple/yachalk/yachalk-0.1.5-py3-none-any.whl (13 kB) Collecting importlib-resources Downloading https://www.piwheels.org/simple/importlib-resources/importlib_resources-5.10.1-py3-none-any.whl (34 kB) Requirement already satisfied: setuptools in /home/rebalance-lnd/rebalance/lib/python3.9/site-packages (from yachalk==0.1.5->-r requirements.txt (line 5)) (65.6.3) Collecting zipp>=3.1.0 Downloading zipp-3.11.0-py3-none-any.whl (6.6 kB) Installing collected packages: zipp, six, protobuf, grpcio, importlib-resources, googleapis-common-protos, yachalk Successfully installed googleapis-common-protos-1.57.0 grpcio-1.51.1 importlib-resources-5.10.1 protobuf-3.20.2 six-1.16.0 yachalk-0.1.5 zipp-3.11.0

t:~/rebalance/rebalance-lnd $ ls -l total 128 -rw-r--r-- 1 rebalance-lnd rebalance-lnd 292 Dec 6 23:49 docker-compose.yml -rw-r--r-- 1 rebalance-lnd rebalance-lnd 639 Dec 6 23:49 Dockerfile drwxr-xr-x 2 rebalance-lnd rebalance-lnd 4096 Dec 6 23:49 grpc_generated -rw-r--r-- 1 rebalance-lnd rebalance-lnd 1069 Dec 6 23:49 LICENSE -rw-r--r-- 1 rebalance-lnd rebalance-lnd 6841 Dec 6 23:49 lnd.py -rw-r--r-- 1 rebalance-lnd rebalance-lnd 21722 Dec 6 23:49 logic.py -rw-r--r-- 1 rebalance-lnd rebalance-lnd 475 Dec 6 23:49 Makefile -rw-r--r-- 1 rebalance-lnd rebalance-lnd 3826 Dec 6 23:49 output.py -rw-r--r-- 1 rebalance-lnd rebalance-lnd 22089 Dec 6 23:49 README.md -rwxr-xr-x 1 rebalance-lnd rebalance-lnd 20593 Dec 6 23:49 rebalance.py -rw-r--r-- 1 rebalance-lnd rebalance-lnd 92 Dec 6 23:49 requirements.txt -rw-r--r-- 1 rebalance-lnd rebalance-lnd 4951 Dec 6 23:49 routes.py -rw-r--r-- 1 rebalance-lnd rebalance-lnd 829 Dec 6 23:49 setup.py -rw-r--r-- 1 rebalance-lnd rebalance-lnd 476 Dec 6 23:49 test.Dockerfile drwxr-xr-x 3 rebalance-lnd rebalance-lnd 4096 Dec 6 23:49 tests

(rebalance) rebalance-lnd@piblitzed:~/rebalance/rebalance-lnd $ python3 rebalance.py --helpusage: rebalance.py [-h] [--lnddir LNDDIR] [--network NETWORK] [--grpc GRPC] [-l] [--show-all | --show-only CHANNEL | -c] [-o | -i] [-f CHANNEL] [-t CHANNEL] [-A] [-a AMOUNT | -p PERCENTAGE] [--min-amount MIN_AMOUNT] [--min-local MIN_LOCAL] [--min-remote MIN_REMOTE] [-e EXCLUDE] [--reckless] [--fee-factor FEE_FACTOR] [--fee-limit FEE_LIMIT | --fee-ppm-limit FEE_PPM_LIMIT]

optional arguments: -h, --help show this help message and exit --lnddir LNDDIR (default ~/.lnd) lnd directory --network NETWORK (default mainnet) lnd network (mainnet, testnet, simnet, ...) --grpc GRPC (default localhost:10009) lnd gRPC endpoint

list candidates: Show the unbalanced channels.

-l, --list-candidates list candidate channels for rebalance --show-all also show channels with zero rebalance amount --show-only CHANNEL only show information about the given channel -c, --compact Shows a compact list of all channels, one per line including ID, inbound/outbound liquidity, and alias -o, --outgoing lists channels with less than 1,000,000 (--min-remote) satoshis inbound liquidity -i, --incoming (default) lists channels with less than 1,000,000 (--min-local) satoshis outbound liquidity

rebalance: Rebalance a channel. You need to specify at least the 'from' channel (-f) or the 'to' channel (-t).

-f CHANNEL, --from CHANNEL Channel ID of the outgoing channel (funds will be taken from this channel). You may also specify the ID using the colon notation (12345:12:1), or the x notation (12345x12x1). You may also use -1 to choose a random candidate. -t CHANNEL, --to CHANNEL Channel ID of the incoming channel (funds will be sent to this channel). You may also specify the ID using the colon notation (12345:12:1), or the x notation (12345x12x1). You may also use -1 to choose a random candidate. -A, --adjust-amount-to-limits If set, adjust the amount to the limits (--min-local and --min-remote). The script will exit if the adjusted amount is below the --min-amount threshold. As such, this switch can be used if you do NOT want to rebalance if the channel is within the limits. -a AMOUNT, --amount AMOUNT Amount of the rebalance, in satoshis. If not specified, the amount computed for a perfect rebalance will be used -p PERCENTAGE, --percentage PERCENTAGE Set the amount to a percentage of the computed amount. As an example, if this is set to 50, half of the computed amount will be used. See --amount. --min-amount MIN_AMOUNT (Default: 10,000) If the given or computed rebalance amount is below this limit, nothing is done. --min-local MIN_LOCAL (Default: 1,000,000) Ensure that the channels have at least this amount as outbound liquidity. --min-remote MIN_REMOTE (Default: 1,000,000) Ensure that the channels have at least this amount as inbound liquidity. -e EXCLUDE, --exclude EXCLUDE Exclude the given channel. Can be used multiple times. --reckless Allow rebalance transactions that are not economically viable. You might also want to set --min-local 0 and --min-remote 0. If set, you also need to set --amount and either --fee-limit or --fee-ppm-limit, and you must not enable --adjust-amount-to-limits (-A). --fee-factor FEE_FACTOR (default: 1.0) Compare the costs against the expected income, scaled by this factor. As an example, with --fee-factor 1.5, routes that cost at most 150% of the expected earnings are tried. Use values smaller than 1.0 to restrict routes to only consider those earning more/costing less. This factor is ignored with --reckless. --fee-limit FEE_LIMIT If set, only consider rebalance transactions that cost up to the given number of satoshis. Note that the first hop costs are considered, even though you don't have to pay them. --fee-ppm-limit FEE_PPM_LIMIT If set, only consider rebalance transactions that cost up to the given number of satoshis per 1M satoshis sent. Note that the first hop costs are considered, even though you don't have to pay them. (rebalance) rebalance-lnd@piblitzed:~/rebalance/rebalance-lnd $ ^C

maximlomans commented 1 year ago

This seems to be related to the Raspibolt installation guide, which I don't know. Please file the issue there.

I have , but because it occurred again following your guide i assumed it was due to something else so i came here to post the same issue true it isn't a bug related to rebalance-lnd itself and i assumed those competent enough to compile LND would manage python packages just fine but many if not most use prebuilt OS's like ; Umbrell , Raspibolt , Raspiblitz etc

"

maximlomans commented 1 year ago

upgrading pip fixed it