# How to automatically rebalance your channels - profitably!

**URL:** <https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365>\
**Category:** Support and Troubleshooting\
**Created:** [September 13, 2021, 8:35am UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365 "2021-09-13T08:35:37Z")\
**Posts on this page:** 18\
**Page:** 3

<div class="post-metadata">

**Author:** ![n080dy](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/n080dy/32/2207_2.png) [@n080dy](https://community.umbrel.com/u/n080dy)\
**Post date:** [February 27, 2022, 12:24pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/46 "2022-02-27T12:24:16Z")

</div>

> [@The\_Lorax](#):
>
> ## 2. Create a directory on the SSD for the plugin files (so it doesn’t get erased upon updates or SD card reflashes)
> 
> `sudo mkdir -p /mnt/data/upgrades/rebalance-lnd`
> 
> ## 3. Clone the Github Directory (The Files) into your new folder
> 
> `cd /mnt/data/upgrades/rebalance-lnd && git clone https://github.com/C-Otto/rebalance-lnd.git`

@The_Lorax great guide, thank you for sharing 🙏

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`

---

<div class="post-metadata">

**Author:** ![n080dy](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/n080dy/32/2207_2.png) [@n080dy](https://community.umbrel.com/u/n080dy)\
**Post date:** [March 5, 2022, 10:15pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/47 "2022-03-05T22:15:50Z")

</div>

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]`

---

<div class="post-metadata">

**Author:** ![Kale](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/kale/32/1489_2.png) [@Kale](https://community.umbrel.com/u/Kale)\
**Post date:** [April 11, 2022, 10:06pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/48 "2022-04-11T22:06:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![n080dy](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/n080dy/32/2207_2.png) [@n080dy](https://community.umbrel.com/u/n080dy)\
**Post date:** [April 11, 2022, 10:11pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/49 "2022-04-11T22:11:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SatsbyDesign](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/satsbydesign/32/2542_2.png) [@SatsbyDesign](https://community.umbrel.com/u/SatsbyDesign)\
**Post date:** [April 12, 2022, 9:02am UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/50 "2022-04-12T09:02:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![n080dy](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/n080dy/32/2207_2.png) [@n080dy](https://community.umbrel.com/u/n080dy)\
**Post date:** [April 12, 2022, 9:45am UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/51 "2022-04-12T09:45:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SatsbyDesign](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/satsbydesign/32/2542_2.png) [@SatsbyDesign](https://community.umbrel.com/u/SatsbyDesign)\
**Post date:** [April 12, 2022, 10:06am UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/52 "2022-04-12T10:06:03Z")

</div>

Way of SSH

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getumbrel/original/2X/b/bbccf7c3bb8547a70f5433d1462e0f421b23b35f.jpeg)

---

<div class="post-metadata">

**Author:** ![n080dy](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/n080dy/32/2207_2.png) [@n080dy](https://community.umbrel.com/u/n080dy)\
**Post date:** [April 12, 2022, 9:40pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/53 "2022-04-12T21:40:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Diesel](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@Diesel](https://community.umbrel.com/u/Diesel)\
**Post date:** [April 19, 2022, 2:07pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/54 "2022-04-19T14:07:49Z")

</div>

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

> **[GitHub - cryptosharks131/lndg: Lite GUI web interface to analyze lnd data and...](https://github.com/cryptosharks131/lndg#key-features)**
>
> Lite GUI web interface to analyze lnd data and leverage the backend database for automation tools around rebalancing and other basic maintenance tasks. - GitHub - cryptosharks131/lndg: Lite GUI web...

---

<div class="post-metadata">

**Author:** ![HalfAcreRanch](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@HalfAcreRanch](https://community.umbrel.com/u/HalfAcreRanch)\
**Post date:** [December 20, 2022, 9:29pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/55 "2022-12-20T21:29:27Z")

</div>

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??

---

<div class="post-metadata">

**Author:** ![Aydo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/aydo/32/3146_2.png) [@Aydo](https://community.umbrel.com/u/Aydo)\
**Post date:** [December 20, 2022, 10:17pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/56 "2022-12-20T22:17:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wrathmxer](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/wrathmxer/32/3604_2.png) [@wrathmxer](https://community.umbrel.com/u/wrathmxer)\
**Post date:** [December 30, 2022, 10:41pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/57 "2022-12-30T22:41:40Z")

</div>

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]](http://community.umbrel.com/t/after-v0-5-0-the-rebalance-lnd-is-not-working-anymore/7987) which changes the LND directory. So now I’m running the command:

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

---

<div class="post-metadata">

**Author:** ![davidleonar](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@davidleonar](https://community.umbrel.com/u/davidleonar)\
**Post date:** [April 12, 2023, 11:22pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/58 "2023-04-12T23:22:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidleonar](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@davidleonar](https://community.umbrel.com/u/davidleonar)\
**Post date:** [April 13, 2023, 1:59pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/59 "2023-04-13T13:59:50Z")

</div>

> [@The\_Lorax](#):
>
> /mnt/data/upgrades/rebalance-lnd/rebalance.py -c

Update: just restarted Umbrel and it worked. 🥺

---

<div class="post-metadata">

**Author:** ![wvdg](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@wvdg](https://community.umbrel.com/u/wvdg)\
**Post date:** [November 19, 2023, 4:08pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/60 "2023-11-19T16:08:41Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![wvdg](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@wvdg](https://community.umbrel.com/u/wvdg)\
**Post date:** [November 19, 2023, 10:17pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/61 "2023-11-19T22:17:08Z")

</div>

I updated pip, setuptools, and wheel with (see [Installing Packages - Python Packaging User Guide](https://packaging.python.org/en/latest/tutorials/installing-packages/#ensure-pip-setuptools-and-wheel-are-up-to-date)):  
`python3 -m pip install --upgrade pip setuptools wheel`  
And that helped (it gives some warnings that I ignored for now).

---

<div class="post-metadata">

**Author:** ![BigBoss](https://avatars.discourse-cdn.com/v4/letter/b/85e7bf/32.png) [@BigBoss](https://community.umbrel.com/u/BigBoss)\
**Post date:** [March 15, 2025, 5:22pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/62 "2025-03-15T17:22:51Z")

</div>

Hi,

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

-bash: pip: command not found

 ![Capture d’écran 2025-03-15 à 17.46.17](https://canada1.discourse-cdn.com/flex030/uploads/getumbrel/original/2X/1/14288fe099e7e179aa75ee74e81648a297ab1caf.png)

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

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getumbrel/original/2X/5/56665140339399c6ae5159ab726c30134ebe4c76.png)

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

thanks for help

---

<div class="post-metadata">

**Author:** ![henning](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@henning](https://community.umbrel.com/u/henning)\
**Post date:** [August 30, 2025, 6:36pm UTC](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365/63 "2025-08-30T18:36:29Z")

</div>

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!

[Previous page](https://community.umbrel.com/t/how-to-automatically-rebalance-your-channels-profitably/3365.md?page=2)
