borgbase / vorta

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

Install Vorta to virtual env #2074

Open goebbe opened 2 months ago

goebbe commented 2 months ago

Description

Using a new installation of Linux Mint 22, CE based on Ubuntu 24.04 LTS I ran into the following issues: Following the installation instructions in the documentation, using pip3, did lead to error messages that are related to virtenv in Python and missing packages.

pip3 install vorta gives the following error message:

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

On stackoverflow, there is a popular post, that recommends the use of pipx (instead of pip3) - to avoid this error. https://stackoverflow.com/questions/75608323/how-do-i-solve-error-externally-managed-environment-every-time-i-use-pip-3

sudo apt install pipx
pipx install vorta

The installation via pipx seemed to wok fine, however, when starting Vorta in the terminal, I got the following error message:

$ vorta
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-egl, linuxfb, minimal, eglfs, vkkhrdisplay, offscreen, minimalegl, xcb, wayland, vnc.

Aborted (core dumped)

Another web-search revealed that the following package was missing (this likely also applies when installing Vorta via pip3, on Debian based distributions): sudo apt install -y libxcb-cursor-dev

I installed the package and Vorta could be started from the terminal.

Finally, Vorta/ borg uses FUSE to mount remote backups, while Fuse is installed by default on Linux Mint, the corresponding python package has to be installed manually:
sudo apt install python3-llfuse

To summarize, on Linux Mint 22 (or Ubuntu 24.04), the following commands install Vorta (via pipx):

sudo apt install pipx libxcb-cursor-dev borgbackup python3-llfuse
pipx install vorta
pipx ensure-env

I hope this is helpful to other users of Debian based distributions. Not sure if this could/ should be added to the documentation.

Reproduction

OS

Linux Mint 22, Cinammon Edition

Version of Vorta

0.9.1

What did you install Vorta with?

Pip

Version of Borg

No response

Logs

No response

Edit: Added the info about the FUSE package

m3nu commented 2 months ago

You don't need pipx. Just a normal virtualenv will do. You shouldn't mess with the system Python install. Personally I like to install each app in /opt. E.g. Borg would go to /opt/borg which is a virtual env. To run borg /opt/borg/bin/borg. Commands are like this:

python -m venv /opt/vorta
source /opt/vorta/bin/activate
pip install vorta
vorta
...
deactivate

Official docs: https://docs.python.org/3/library/venv.html

m3nu commented 2 months ago

If you install it for one user only, I might use pyenv, which users ~/.pyenv. Or with pure Python venv, I would use ~/.venv/vorta.

goebbe commented 2 months ago

Thanks for commenting and providing guidance on how/ where to define the virtualenv. This might be obvious to anybody using Python venv regularly, but it wasn't for me. :-)

Reading your comment, I realise that it would have been better to split this "issue". There are two distinct parts that are not documented, when installing Vorta via pip - or at least I did not find it:

  1. a virtualenv has to be defined/ set
  2. some additional packages have to be installed, when using pip (or pipx) to install Vorta.