How to automatically rebalance your channels - profitably!

@The_Lorax great guide, thank you for sharing :pray:

I suggest editing the command in step 2. to sudo mkdir -p /mnt/data/upgrades/ as the git clone in step 3. will create the /rebalance-lnd folder

In step 3. instead will be easier if the command is split two:

3a. cd /mnt/data/upgrades/rebalance-lnd
3b. git clone https://github.com/C-Otto/rebalance-lnd.git

I still have not got any luck with rebalance-lnd apart an output message saying Could not find any suitable route!

I tried all channels I’d like to rebalance (not many on my side) and all of them give the same output message calling rebalance.py -t [NODEIDHERE]

try LNDg for a rebalancer. its the best and its built in automation

Yeah, that’s what I’m using now… plus the hammock to support my body weight while looking at the routed transactions :slight_smile:

I’ve attempted this solution above, with this error message:

fatal: could not create work tree dir ‘rebalance-lnd’: Permission denied

am I missing steps?

on umbrel or via ssh? Can you share a screenshot?

Way of SSH

try sudo git clone... and insert your password when needed

Mind sharing what your AR settings are? I’ve tried setting up AR through LNDg but none of my channels have actually rebalanced yet… Is there a better tutorial you’re aware of outside of the GitHub page? I’m using the sample Global Settings from here but nothing seems to be happening

I tried installing python, it looks like it started and then gave me “[notice] A new release of pip available: 22.3 -> 22.3.1
When I try step 4 it says “no such file or directory”

is there a new version of Python that I need a different command to install??

You shouldn’t be installing python, it’s already installed. The command in step 4 is installing dependencies based on the requirements.txt file (it’s a list of dependencies and the version numbers to install).

Your error suggests that either the rebalance-lnd directory wasn’t created from step 2 or the git clone command from step 3 failed which means the requirements.txt file wasn’t cloned to your system, therefore, it can’t find the file.

Re-run the commands one-by-one and post the full output of the commands. Ignore the pip updates for now.

Ran into the an error when running the command:

./rebalance.py -c

Error:

FileNotFoundError: [Errno 2] No such file or directory: ‘/root/.lnd/tls.cert’

Found the answer in [this thread] which changes the LND directory. So now I’m running the command:

./rebalance.py --lnddir /home/umbrel/umbrel/app-data/lightning/data/lnd -c

Hey everyone!

I got stuck in step 4

It kept “Running setup.py bdist_wheel for grpcio ... |” and stayed there up to 24 hours, then I decided to cancel the process.

Any suggestions or other ways to install the dependencies in “requirements.txt”?

Thanks.

Update: just restarted Umbrel and it worked. :pleading_face:

Thank you for the instructions, I get an error when installing the Python dependencies on Umbrel:

umbrel@umbrel:/mnt/data/upgrades/rebalance-lnd $ pip3 install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting googleapis-common-protos==1.61.0 (from -r requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/21/49/12996dc0238e017504dceea1d121a48bd49fb3f4416f40d59fc3e924b4f3/googleapis_common_protos-1.61.0-py2.py3-none-any.whl
Collecting grpcio==1.59.2 (from -r requirements.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/93/95/7c72028fe9fc46748fb769b13a1e0923acbb79095cd5124b8bac0cebd38c/grpcio-1.59.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-012od1g9/grpcio/setup.py", line 95, in <module>
        import commands
      File "/tmp/pip-install-012od1g9/grpcio/src/python/grpcio/commands.py", line 31, in <module>
        import support
      File "/tmp/pip-install-012od1g9/grpcio/src/python/grpcio/support.py", line 21, in <module>
        from setuptools import errors
    ImportError: cannot import name 'errors' from 'setuptools' (/usr/lib/python3/dist-packages/setuptools/__init__.py)
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-012od1g9/grpcio/

Any ideas?
Thanks, Willem

I updated pip, setuptools, and wheel with (see Installing Packages - Python Packaging User Guide):
python3 -m pip install --upgrade pip setuptools wheel
And that helped (it gives some warnings that I ignored for now).

Hi,

4 years later I try this tutorial and at step 4 I get this error :

-bash: pip: command not found

after installing pip and retrying the step 4 command I get this new error :

has anyone had this problem before? and if so, is there a solution?

thanks for help

You basically have two options to shut it up here, which it tells you. Option one (preferred):

create a virtual environment-

sudo python3 -m venv my-venv

sudo my-venv/bin/pip install -r requirements.txt

or you can tell it “i don’t care shut up lalala”-

sudo pip3 install -r requirements.txt –break-system-packages

I recommend restarting umbrel after this, then running:

/mnt/data/upgrades/rebalance-lnd/rebalance.py -c

If at this point it lists your channels, you are good. Good luck with this!