Unable to import Apprise in monitoring hook #862

Closed
opened 2024-05-03 10:24:34 +00:00 by CameronPrior · 5 comments

What I'm trying to do and why

I am currently trying to get some discord notifications working for my backups.
I have followed the instructions on the borgmatic wiki (https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/#apprise-hook) however it doesnt seem to want to work.

I ran the pipx install command and i get the following output

⚠️  File exists at /root/.local/bin/borgmatic and points to /root/.local/pipx/venvs/borgmatic/bin/borgmatic. Not modifying.
⚠️  File exists at /root/.local/bin/generate-borgmatic-config and points to /root/.local/pipx/venvs/borgmatic/bin/generate-borgmatic-config. Not modifying.
⚠️  File exists at /root/.local/bin/validate-borgmatic-config and points to /root/.local/pipx/venvs/borgmatic/bin/validate-borgmatic-config. Not modifying.
  installed package 'borgmatic[Apprise]' 1.8.11, Python 3.8.10
   - borgmatic (symlink not installed)
   - generate-borgmatic-config (symlink not installed)
    - validate-borgmatic-config (symlink not installed)
done! ✨ 🌟 ✨

Running the backup with verbose 2 results in the following

/mnt/sdb/borg/paperless.yaml: Calling apprise hook function initialize_monitor
/mnt/sdb/borg/paperless.yaml: Calling apprise hook function ping_monitor
Unable to import Apprise in monitoring hook

Steps to reproduce

Configuration looks like this

apprise:
    services:
        - url: discord://REDACTED
          label: discord
    states:
        - start
        - finish
        - fail

Actual behavior

/mnt/sdb/borg/paperless.yaml: Calling apprise hook function ping_monitor
Unable to import Apprise in monitoring hook
/mnt/sdb/borg/paperless.yaml: Calling apprise hook function ping_monitor
Unable to import Apprise in monitoring hook
/mnt/sdb/borg/paperless.yaml: Calling apprise hook function destroy_monitor
/mnt/sdb/borg/paperless.yaml: No commands to run for post-everything hook

Expected behavior

No response

Other notes / implementation ideas

No response

borgmatic version

1.8.9

borgmatic installation method

pipx install

Borg version

1.1.15

Python version

3.8.10

Database version (if applicable)

No response

Operating system and version

Ubuntu 20.04.6 LTS

### What I'm trying to do and why I am currently trying to get some discord notifications working for my backups. I have followed the instructions on the borgmatic wiki (https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/#apprise-hook) however it doesnt seem to want to work. I ran the pipx install command and i get the following output ```Installing to existing directory '/root/.local/pipx/venvs/borgmatic[Apprise]' ⚠️ File exists at /root/.local/bin/borgmatic and points to /root/.local/pipx/venvs/borgmatic/bin/borgmatic. Not modifying. ⚠️ File exists at /root/.local/bin/generate-borgmatic-config and points to /root/.local/pipx/venvs/borgmatic/bin/generate-borgmatic-config. Not modifying. ⚠️ File exists at /root/.local/bin/validate-borgmatic-config and points to /root/.local/pipx/venvs/borgmatic/bin/validate-borgmatic-config. Not modifying. installed package 'borgmatic[Apprise]' 1.8.11, Python 3.8.10 - borgmatic (symlink not installed) - generate-borgmatic-config (symlink not installed) - validate-borgmatic-config (symlink not installed) done! ✨ 🌟 ✨ ``` Running the backup with verbose 2 results in the following ``` /mnt/sdb/borg/paperless.yaml: Calling apprise hook function initialize_monitor /mnt/sdb/borg/paperless.yaml: Calling apprise hook function ping_monitor Unable to import Apprise in monitoring hook ``` ### Steps to reproduce Configuration looks like this ``` apprise: services: - url: discord://REDACTED label: discord states: - start - finish - fail ``` ### Actual behavior ``` /mnt/sdb/borg/paperless.yaml: Calling apprise hook function ping_monitor Unable to import Apprise in monitoring hook /mnt/sdb/borg/paperless.yaml: Calling apprise hook function ping_monitor Unable to import Apprise in monitoring hook /mnt/sdb/borg/paperless.yaml: Calling apprise hook function destroy_monitor /mnt/sdb/borg/paperless.yaml: No commands to run for post-everything hook ``` ### Expected behavior _No response_ ### Other notes / implementation ideas _No response_ ### borgmatic version 1.8.9 ### borgmatic installation method pipx install ### Borg version 1.1.15 ### Python version 3.8.10 ### Database version (if applicable) _No response_ ### Operating system and version Ubuntu 20.04.6 LTS
Owner

Thanks for taking the time to file this. Have you run through the pipx setup described in the general borgmatic installation docs? Specifically the ensurepath part? And are you sure you don't have multiple copies of borgmatic installed? When you run which borgmatic, what does the output show?

Thanks for taking the time to file this. Have you run through the [pipx setup](https://torsion.org/borgmatic/docs/how-to/set-up-backups/) described in the general borgmatic installation docs? Specifically the `ensurepath` part? And are you sure you don't have multiple copies of borgmatic installed? When you run `which borgmatic`, what does the output show?
Author

Thanks for taking the time to file this. Have you run through the pipx setup described in the general borgmatic installation docs? Specifically the ensurepath part? And are you sure you don't have multiple copies of borgmatic installed? When you run which borgmatic, what does the output show?

Hey witten

I did follow that part of the setup as I am running borgmatic as root.
Here is the output from the commands.

root@borr:/# which borgmatic
/root/.local/bin/borgmatic

root@borr:/# pipx ensurepath
Your PATH looks like it already is set up for pipx. Pass `--force` to modify the PATH.

pipx list shows the following output

root@borr:/# pipx list
venvs are in /root/.local/pipx/venvs
binaries are exposed on your $PATH at /root/.local/bin
   package borgmatic 1.8.9, Python 3.8.10
    - borgmatic
    - generate-borgmatic-config
    - validate-borgmatic-config
   package 'borgmatic[Apprise]' 1.8.11, Python 3.8.10
    - borgmatic (symlink not installed)
    - generate-borgmatic-config (symlink not installed)
    - validate-borgmatic-config (symlink not installed)
> Thanks for taking the time to file this. Have you run through the [pipx setup](https://torsion.org/borgmatic/docs/how-to/set-up-backups/) described in the general borgmatic installation docs? Specifically the `ensurepath` part? And are you sure you don't have multiple copies of borgmatic installed? When you run `which borgmatic`, what does the output show? Hey witten I did follow that part of the setup as I am running borgmatic as root. Here is the output from the commands. ``` root@borr:/# which borgmatic /root/.local/bin/borgmatic root@borr:/# pipx ensurepath Your PATH looks like it already is set up for pipx. Pass `--force` to modify the PATH. ``` pipx list shows the following output ``` root@borr:/# pipx list venvs are in /root/.local/pipx/venvs binaries are exposed on your $PATH at /root/.local/bin package borgmatic 1.8.9, Python 3.8.10 - borgmatic - generate-borgmatic-config - validate-borgmatic-config package 'borgmatic[Apprise]' 1.8.11, Python 3.8.10 - borgmatic (symlink not installed) - generate-borgmatic-config (symlink not installed) - validate-borgmatic-config (symlink not installed) ```
Owner

Iiinteresting. It does look like borgmatic is installed twice, both with pipx! And it looks like when you run borgmatic, it's running the version that's installed without Apprise, which would explain the error you're getting. So my recommendation would be to pipx uninstall both versions (and confirm with pipx list) and then start over by installing just borgmatic[Apprise]. Let me know how that goes!

(I may have to change the documentation to help avoid this sort of situation for other users.)

Iiinteresting. It does look like borgmatic is installed twice, both with pipx! And it looks like when you run borgmatic, it's running the version that's installed _without_ Apprise, which would explain the error you're getting. So my recommendation would be to `pipx uninstall` _both_ versions (and confirm with `pipx list`) and then start over by installing just `borgmatic[Apprise]`. Let me know how that goes! (I may have to change the documentation to help avoid this sort of situation for other users.)
Author

That was it!

I almost did that to begin with then decided against it.
Would be worth updating the doco for people like me.

Thanks for the help

That was it! I almost did that to begin with then decided against it. Would be worth updating the doco for people like me. Thanks for the help
Owner

I'm glad to hear that did it!

I'm glad to hear that did it!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#862
No description provided.