borgbase / vorta

Desktop Backup Client for Borg Backup
https://vorta.borgbase.com
GNU General Public License v3.0
1.98k stars 130 forks source link

Vorta won't launch with latest python-tzlocal (version 4.0.1-1) #1083

Closed Pierrep56 closed 2 years ago

Pierrep56 commented 2 years ago

Latest Vorta version (0.7.8.) does not launch on Arch based distro with actual python-tzlocal version updated to 4.0.1.

To reproduce: 1) Install vorta from AUR (vorta-git has the same issue at the moment) 2) open a terminal and run "vorta" 3) you'll get an output ending with wrong required version of python-tzlocal

Workaround: The actual version of python-tzlocal is 4.0.1-1. Downgrade to 2.1 and vorta can be launched again.

m3nu commented 2 years ago

Thanks for reporting. Anything we can change in Vorta to support all versions of python-tzlocal or are we using it via another dependency?

You also didn't post the actual error. This would be helpful to assess the issue.

Pierrep56 commented 2 years ago

Hello @m3nu , here is the error I got. Thanks for reminding me to post it

Traceback (most recent call last): File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 568, in _build_master ws.require(requires) File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 886, in require needed = self.resolve(parse_requirements(requirements)) File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 777, in resolve raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.ContextualVersionConflict: (tzlocal 4.0.1 (/usr/lib/python3.9/site-packages), Requirement.parse(‘tzlocal~=2.0’), {‘apscheduler’})

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/usr/bin/vorta”, line 33, in sys.exit(load_entry_point(‘vorta==0.7.8’, ‘gui_scripts’, ‘vorta’)()) File “/usr/bin/vorta”, line 25, in importlib_load_entry_point return next(matches).load() File “/usr/lib/python3.9/importlib/metadata.py”, line 77, in load module = import_module(match.group(‘module’)) File “/usr/lib/python3.9/importlib/init.py”, line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “”, line 1030, in _gcd_import File “”, line 1007, in _find_and_load File “”, line 986, in _find_and_load_unlocked File “”, line 680, in _load_unlocked File “”, line 850, in exec_module File “”, line 228, in _call_with_frames_removed File “/usr/lib/python3.9/site-packages/vorta/main.py”, line 10, in from vorta.models import init_db File “/usr/lib/python3.9/site-packages/vorta/models.py”, line 17, in from vorta.utils import slugify File “/usr/lib/python3.9/site-packages/vorta/utils.py”, line 21, in from vorta.borg._compatibility import BorgCompatibility File “/usr/lib/python3.9/site-packages/vorta/borg/_compatibility.py”, line 1, in from pkg_resources import parse_version File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 3243, in def _initialize_master_working_set(): File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 3226, in _call_aside f(*args, **kwargs) File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 3255, in _initialize_master_working_set working_set = WorkingSet._build_master() File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 570, in _build_master return cls._build_from_requirements(requires) File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 583, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File “/usr/lib/python3.9/site-packages/pkg_resources/init.py”, line 772, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The ‘tzlocal~=2.0’ distribution was not found and is required by apscheduler

nrbeaton commented 2 years ago

Same issue!

python-apscheduler (https://archlinux.org/packages/community/any/python-apscheduler/) has been flagged out of date, is that causing the issue?

stephensrmmartin commented 2 years ago

Python-apscheduler is at 3.7, which I believe is the latest release.

The latest git commits of apscheduler has support for tzlocal >= 3.0. However, the latest apscheduler no longer has support for qt scheduling (it's listed on the chopping block of features for the next big release, though they make it clear that doesn't mean it's permanently gone in future releases).

I was hit by this too. I haven't solved it.

Once tzlocal was updated, I got the error above.

Then narrowed it down to apscheduler. I saw in their commits that it should support new tzlocal, so I used arch's build system to modify the pkgbuild and install an updated apscheduler.

Then the error has to do with a missing qt scheduler when launching vorta.

So my guess is - you all will need to either contribute a qt schedule upstream to apscheduler, or use an alternative scheduler.

stephensrmmartin commented 2 years ago

I re-installed my updated apscheduler package and launched vorta:

2021-10-21 09:55:32,327 - root - CRITICAL - Uncaught exception, file a report at https://github.com/borgbase/vorta/issues/new
Traceback (most recent call last):
  File "/usr/bin/vorta", line 33, in <module>
    sys.exit(load_entry_point('vorta==0.7.8', 'gui_scripts', 'vorta')())
  File "/usr/lib/python3.9/site-packages/vorta/__main__.py", line 57, in main
    from vorta.application import VortaApp
  File "/usr/lib/python3.9/site-packages/vorta/application.py", line 17, in <module>
    from vorta.scheduler import VortaScheduler
  File "/usr/lib/python3.9/site-packages/vorta/scheduler.py", line 5, in <module>
    from apscheduler.schedulers.qt import QtScheduler
ModuleNotFoundError: No module named 'apscheduler.schedulers.qt'

And this shows that apscheduler.schedulers.qt will be chopped.

m3nu commented 2 years ago

I'm aware that we can't use apscheduler in the future and already started adding our own scheduler, since our use case is fairly simple. But not finished yet.

Currently we pin the apscheduler version to below 4 here. So you can't just update it to 4.

m3nu commented 2 years ago

Should we pin tzlocal to a lower version until the apscheduler dep is removed?

m3nu commented 2 years ago

Pinning the tzlocal version until #908 is ready to merge.

m3nu commented 2 years ago

I've removed APScheduler in #1086. Would appreciate any feedback and testing, since it's a big change to an important part.

bastiencyr commented 2 years ago

Maybe the option "Run missed backups" can be global (in misc) and not per profile ?

m3nu commented 2 years ago

Good to think about this. I didn't consider the trade-offs in-depth when I added it.

After thinking about it again, I still think the option belongs to the profile, not the app. I may have some repos I only use occasionally. I may not want catch-up for them. It can be annoying if 5 repos start backing up after not running Vorta for a while. So I'd prefer to leave it per-profile for now, unless there is a strong reason against.

stephensrmmartin commented 2 years ago

Just installed your Vorta PR here, and it seems to be working well for me. I have a simple usecase though - Just one profile, 5 sources, backed up to a mounted spinner every 3 hours. I really appreciate the work you put into replacing the dependency.

Is there anything in particular you'd like me to test? I'm happy to try.

m3nu commented 2 years ago

Glad to hear that and thanks for testing!

I expect that we will get more input regarding the new scheduling as more people use it. The currently implementation is relatively simple: It schedules jobs regarding the set interval and rechecks every 15 min if something was missed. I'm not even sure what happens if a timer runs out while the machine is hibernated. It may fire on wakeup or may be rescheduled. Here we could add hooks to do stuff on wakeup.

Important thing is that the new implementation is our own and we can add improvements and complexity as we find issues.

Is there anything in particular you'd like me to test? I'm happy to try.

This PR also adds Python 3.10 support, which needed a few small type fixes. So testing on that would be good. And gaining more experience with behavior after hibernation or shutdowns would be good.

NovaViper commented 2 years ago

The issue is still present in the ArchLinux repos, when will the repos there be updated?

ryanfantus commented 2 years ago

The archlinux repos track the releases here, and the most recent release was v0.7.8, 26 August. If you prefer to track what's the latest cut of master, use the -git package.

NovaViper commented 2 years ago

The archlinux repos track the releases here, and the most recent release was v0.7.8, 26 August. If you prefer to track what's the latest cut of master, use the -git package.

I tried both, both of them have the same issue. In fact the git version hasn't been updated since May of this year

bastiencyr commented 2 years ago

Dont know very well arch linux but the git version was updated recently. So it may be a problem on your side.

In any case, there is a pending PR in #1086 that will solved this issue but its not merged. Thanks to @m3nu who has worked fast to solve this and it will be merged in few days.

NovaViper commented 2 years ago

Dont know very well arch linux but the git version was updated recently. So it may be a problem on your side.

In any case, there is a pending PR in #1086 that will solved this issue but its not merged. Thanks to @m3nu who has worked fast to solve this and it will be merged in few days.

The git repo isn't updated at all: https://aur.archlinux.org/packages/vorta-git/ it's on commit be6a39b. And the non git version is on v0.7.8, which is the version from August 26th.

stephensrmmartin commented 2 years ago

@NovaViper

The git versioning in the AUR isn't super important, because unless they bump the pkgbuild, the pkgver stays the same, even though actually building it will pull from the latest master. I.e., the -git aur pkgs can be untouched for 5 years, but still install the latest version.

Anyway, you have to change the git repo, because as @bastiencyr said - it's not merged here yet.

Edit: You could also, of course, edit the depends to remove anything not needed anymore - like python-apscheduler. This was just hastily edited to get the latest PR going.

# Maintainer: Jose Riha <jose 1711 gmail com>

pkgname=vorta-git
_pkgname=vorta
pkgver=r573.4785594
pkgrel=1
pkgdesc="A GUI for BorgBackup (git)"
arch=('any')
url="https://github.com/borgbase/vorta"
license=('GPL')
provides=('vorta')
conflicts=('vorta')
depends=('borg' 'python-appdirs' 'python-apscheduler' 'python-pyqt5' 'python-peewee' 'python-paramiko' 'python-dateutil' 'python-secretstorage' 'python-psutil' 'python-llfuse' 'python-setuptools')
makedepends=('qt5-tools' 'python-pip' 'git')
options=(!emptydirs)
source=("$pkgname"::"git+https://github.com/m3nu/${_pkgname}#branch=feat/replace-scheduler")
sha256sums=('SKIP')

build() {
  cd "${srcdir}/${pkgname}"
  make translations-to-qm
  python setup.py build
}

pkgver() {
  cd "${srcdir}/${pkgname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
  cd "${srcdir}/${pkgname}"
  export PYTHONHASHSEED=0
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build

  install -Dm644 package/icon-symbolic.svg \
    "$pkgdir/usr/share/icons/hicolor/symbolic/apps/com.borgbase.Vorta-symbolic.svg"
  install -Dm644 "src/$_pkgname/assets/metadata/com.borgbase.Vorta.appdata.xml" -t \
    "$pkgdir/usr/share/metainfo"
  install -Dm644 "src/$_pkgname/assets/metadata/com.borgbase.Vorta.desktop" -t \
    "$pkgdir/usr/share/applications"
}

# vim:set ts=2 sw=2 et:
m3nu commented 2 years ago

The issue is still present in the ArchLinux repos, when will the repos there be updated?

The PR (#1086) is ready and will be merged in the next days. I just want to give everyone a chance to review and comment. @bastiencyr was already very helpful in improving it.

The merge will go into the current master branch, which will be version 0.8.x eventually. If you want to stick with 0.7.x, you need to pin your dependencies, like I did in ce9ecf0db25b8e0e96fbcfd6d61e3163235ea159.

NovaViper commented 2 years ago

Ah ok. How do I go about installing the PR as a temporary until the update gets pushed?

m3nu commented 2 years ago

You would use the feature branch from my personal repo. Might even work via Pip.

https://github.com/m3nu/vorta/tree/feat/replace-scheduler

Would be great to get some more testing and feedback.

NovaViper commented 2 years ago

You would use the feature branch from my personal repo. Might even work via Pip.

https://github.com/m3nu/vorta/tree/feat/replace-scheduler

Would be great to get some more testing and feedback.

Im trying to isntall it but yay for some reason refuses to install your repo..and I can't find a guide that shows how to install vorta using a different repo

stephensrmmartin commented 2 years ago

@NovaViper

I posted the PKGBUILD above. Just use makepkg to build and install it.

Download the PKGBUILD into /some/directory/PKGBUILD cd /some/directory makepkg -scif

Done.

NovaViper commented 2 years ago

@NovaViper

I posted the PKGBUILD above. Just use makepkg to build and install it.

Download the PKGBUILD into /some/directory/PKGBUILD cd /some/directory makepkg -scif

Done.

Ah cool, I installed it and now it works! Thanks!

m3nu commented 2 years ago

This PR is now merged. Please use the current master branch to get any fixes.

Here is how to install the current master branch via Pip.

NovaViper commented 2 years ago

@stephensrmmartin Thank you!

NovaViper commented 2 years ago

This PR is now merged. Please use the current master branch to get any fixes.

Here is how to install the current master branch via Pip.

Yeee the arch-git repo actually pulled the latest version, now it works!