slgobinath / SafeEyes

Protect your eyes from eye strain using this simple and beautiful, yet extensible break reminder
http://slgobinath.github.io/SafeEyes/
GNU General Public License v3.0
1.45k stars 163 forks source link

Error when installing with pipx #455

Closed ajeetdsouza closed 2 months ago

ajeetdsouza commented 3 years ago

Describe the bug

When installed with pipx, safeeyes fails to start with the following error:

Traceback (most recent call last):
  File "/home/ajeet/.local/bin/safeeyes", line 5, in <module>
    from safeeyes.__main__ import main
  File "/home/ajeet/.local/pipx/venvs/safeeyes/lib64/python3.9/site-packages/safeeyes/__main__.py", line 34, in <module>
    from safeeyes.safeeyes import SafeEyes
  File "/home/ajeet/.local/pipx/venvs/safeeyes/lib64/python3.9/site-packages/safeeyes/safeeyes.py", line 28, in <module>
    import dbus
ModuleNotFoundError: No module named 'dbus'

To Reproduce Steps to reproduce the behavior (on Fedora):

  1. sudo dnf install pipx libappindicator-gtk3 python3-psutil cairo-devel python3-devel gobject-introspection-devel cairo-gobject-devel
  2. pipx install safeeyes
  3. safeeyes

Expected behavior

pipx installs Python programs in an isolated manner, so that they don't end up conflicting with other Python programs. It would be great if safeeyes could be installed correctly using pipx.

Desktop (please complete the following information):

slgobinath commented 3 years ago

Hi, can you also install dbus-python using pipx? I'm not familiar with pipx but I think it should be similar to installing in a python virtual environment.

Please check the installation instructions on installing in python virtual environment in the readme file https://github.com/slgobinath/SafeEyes#install-in-virtual-environment

ajeetdsouza commented 3 years ago

dbus-python is a library, right? pipx is meant for installing binaries in an isolated manner, so I don't think a library can be installed as such. I tried pipx install dbus-python anyway:

Fatal error from pip prevented installation. Full pip output in file:
    /home/ajeet/.local/pipx/logs/cmd_2021-07-03_21.04.41_pip_errors.log

pip failed to build package:
    dbus-python

Some possibly relevant errors from pip install:
    Package 'dbus-1', required by 'virtual:world', not found
    subprocess.CalledProcessError: Command '['/tmp/pip-install-b47usr7w/dbus-python_159cf7d71d0d42dc9e9fc2b897119093/configure', '--disable-maintainer-mode', 'PYTHON=/home/ajeet/.local/pipx/venvs/dbus-python/bin/python', '--prefix=/tmp/pip-install-b47usr7w/dbus-python_159cf7d71d0d42dc9e9fc2b897119093/build/temp.linux-x86_64-3.9/prefix']' returned non-zero exit status 1.

Error installing dbus-python.
slgobinath commented 3 years ago

The problem is similar to this https://github.com/pypa/pipx/issues/703#issue-912727439

As described in that issue, if it's possible to activate the virtual environment manually, you can install safe eyes as described in the readme.

Safe Eyes relies on python dbus library but it's not included in the Python dependency list as it is preinstalled on most of the Linux systems and I don't want to introduce any conflicts in dbus installation. However I will look for any better solution to manage the dependency.

lamyergeier commented 1 year ago

Fedora 38

$ sudo dnf install libappindicator-gtk3 python3-psutil cairo-devel python3-devel gobject-introspection-devel cairo-gobject-devel
Place your right ring finger on the fingerprint reader
Fedora 38 - x86_64 - Updates                                 81 kB/s |  19 kB     00:00    
Fedora 38 - x86_64 - Updates                                1.1 MB/s | 476 kB     00:00    
Fedora Modular 38 - x86_64 - Updates                        262 kB/s |  19 kB     00:00    
Package libappindicator-gtk3-12.10.1-1.fc38.x86_64 is already installed.
Package python3-psutil-5.9.2-2.fc38.x86_64 is already installed.
Package cairo-devel-1.17.8-4.fc38.x86_64 is already installed.
Package gobject-introspection-devel-1.76.1-1.fc38.x86_64 is already installed.
Package cairo-gobject-devel-1.17.8-4.fc38.x86_64 is already installed.
Dependencies resolved.
============================================================================================
 Package                           Architecture  Version               Repository      Size
============================================================================================
Installing:
 python3-devel                     x86_64        3.11.4-1.fc38         updates        269 k
Upgrading:
 python-unversioned-command        noarch        3.11.4-1.fc38         updates         11 k
 python3                           x86_64        3.11.4-1.fc38         updates         28 k
 python3-libs                      x86_64        3.11.4-1.fc38         updates        9.6 M
 python3-tkinter                   x86_64        3.11.4-1.fc38         updates        418 k
Installing weak dependencies:
 python3-pip                       noarch        22.3.1-2.fc38         fedora         3.1 M

Transaction Summary
============================================================================================
Install  2 Packages
Upgrade  4 Packages

Total download size: 13 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): python-unversioned-command-3.11.4-1.fc38.noarch.rpm  143 kB/s |  11 kB     00:00    
(2/6): python3-3.11.4-1.fc38.x86_64.rpm                     805 kB/s |  28 kB     00:00    
(3/6): python3-devel-3.11.4-1.fc38.x86_64.rpm               2.2 MB/s | 269 kB     00:00    
(4/6): python3-tkinter-3.11.4-1.fc38.x86_64.rpm             3.5 MB/s | 418 kB     00:00    
(5/6): python3-pip-22.3.1-2.fc38.noarch.rpm                 2.5 MB/s | 3.1 MB     00:01    
(6/6): python3-libs-3.11.4-1.fc38.x86_64.rpm                4.9 MB/s | 9.6 MB     00:01    
--------------------------------------------------------------------------------------------
Total                                                       6.1 MB/s |  13 MB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                    1/1 
  Upgrading        : python3-libs-3.11.4-1.fc38.x86_64                                 1/10 
  Upgrading        : python3-tkinter-3.11.4-1.fc38.x86_64                              2/10 
  Upgrading        : python3-3.11.4-1.fc38.x86_64                                      3/10 
  Upgrading        : python-unversioned-command-3.11.4-1.fc38.noarch                   4/10 
  Installing       : python3-pip-22.3.1-2.fc38.noarch                                  5/10 
  Installing       : python3-devel-3.11.4-1.fc38.x86_64                                6/10 
  Cleanup          : python-unversioned-command-3.11.3-2.fc38.noarch                   7/10 
  Cleanup          : python3-tkinter-3.11.3-2.fc38.x86_64                              8/10 
  Cleanup          : python3-3.11.3-2.fc38.x86_64                                      9/10 
  Cleanup          : python3-libs-3.11.3-2.fc38.x86_64                                10/10 
  Running scriptlet: python3-libs-3.11.3-2.fc38.x86_64                                10/10 
  Verifying        : python3-pip-22.3.1-2.fc38.noarch                                  1/10 
  Verifying        : python3-devel-3.11.4-1.fc38.x86_64                                2/10 
  Verifying        : python-unversioned-command-3.11.4-1.fc38.noarch                   3/10 
  Verifying        : python-unversioned-command-3.11.3-2.fc38.noarch                   4/10 
  Verifying        : python3-3.11.4-1.fc38.x86_64                                      5/10 
  Verifying        : python3-3.11.3-2.fc38.x86_64                                      6/10 
  Verifying        : python3-libs-3.11.4-1.fc38.x86_64                                 7/10 
  Verifying        : python3-libs-3.11.3-2.fc38.x86_64                                 8/10 
  Verifying        : python3-tkinter-3.11.4-1.fc38.x86_64                              9/10 
  Verifying        : python3-tkinter-3.11.3-2.fc38.x86_64                             10/10 

Upgraded:
  python-unversioned-command-3.11.4-1.fc38.noarch    python3-3.11.4-1.fc38.x86_64           
  python3-libs-3.11.4-1.fc38.x86_64                  python3-tkinter-3.11.4-1.fc38.x86_64   
Installed:
  python3-devel-3.11.4-1.fc38.x86_64            python3-pip-22.3.1-2.fc38.noarch           

Complete!
$ pipx install safeeyes
Fatal error from pip prevented installation. Full pip output in file:
    /mnt/Data/.local/pipx/logs/cmd_2023-07-06_07.35.08_pip_errors.log

pip seemed to fail to build package:
    pycairo

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    Package bzip2 was not found in the pkg-config search path.
    Package 'bzip2', required by 'freetype2', not found

Error installing safeeyes.
archisman-panigrahi commented 2 months ago

@ajeetdsouza @lamyergeier Is this issue still valid?

deltragon commented 2 months ago

The original issue is no longer relevant as https://github.com/slgobinath/SafeEyes/pull/558 dropped the dependency on dbus-python. The issue in the followup comment where pycairo doesn't build I can't reproduce on Fedora either.