Menu

#33 Unresolvable cdemu & gi issue

open
nobody
None
unassigned
default
2022-01-22
2022-01-13
retnev
No

I suddenly get this error and cdemu doesnt work

Traceback (most recent call last):
  File "/usr/local/bin/cdemu", line 29, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'

I checked and gi is installed. Why cant cdemu not find gi.

Discussion

  • Rok Mandeljc

    Rok Mandeljc - 2022-01-13

    What distribution, what python version, how did you install cdemu?

    Is the gobject introspection installed in the same python environment that cdemu is using? Try launching python manually, using the shebang from /usr/local/bin/cdemu (i.e., the first line in the file - for example, "/usr/bin/env python3") and do "import gi" there...

     
  • retnev

    retnev - 2022-01-14

    It has been working for about 2 years now.
    How? well cdemu cant be installed through apt in debian so it was installed from sourceforge download pages.

    Cdemu
    cdemu-daemon-3.2.2.tar.bz2
    vhba-module-20190410.tar.bz2
    libmirage-3.2.2.tar.bz2

    Kernel
    $ cat /proc/version
    Linux version 5.2.0-17.2-liquorix-amd64 (stevep@mxlinux.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)) #1 ZEN SMP PREEMPT liquorix 5.2-26~mx17+1 (2019-09-24)

    Distro
    $cat /etc/lease
    NAME="MX"
    VERSION="18 (Continuum)"
    ID="mx"
    VERSION_ID="18"
    PRETTY_NAME="MX 18 (Continuum)"
    ANSI_COLOR="0;34"
    HOME_URL="https://mxlinux.org"
    BUG_REPORT_URL="https://mxlinux.org"
    PRETTY_NAME="MX 18.3 Continuum"
    DISTRIB_ID=MX
    DISTRIB_RELEASE=18.3
    DISTRIB_CODENAME=Continuum
    DISTRIB_DESCRIPTION="MX 18.3 Continuum"
    PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
    NAME="Debian GNU/Linux"
    VERSION_ID="9"
    VERSION="9 (stretch)"
    VERSION_CODENAME=stretch
    ID=debian
    HOME_URL="https://www.debian.org/"
    SUPPORT_URL="https://www.debian.org/support"
    BUG_REPORT_URL="https://bugs.debian.org/"

    Python
    Python: version (2.7.13-2). (according top apt)

    However: Python3 is also installed and executes on CLI
    $ python3
    Python 3.6.3 (default, Dec 17 2021, 00:18:20)
    [GCC 6.3.0 20170516] on linux
    Type "help", "copyright", "credits" or "license" for more information.

    Cdemu:
    Shebang: #!/usr/bin/env python3

    As per your instructions:

    $ /usr/bin/env python3
    Python 3.6.3 (default, Dec 17 2021, 00:18:20)
    [GCC 6.3.0 20170516] on linux
    Type "help", "copyright", "credits" or "license" for more information.

    import gi
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'gi'</module></stdin>

     
    • Rok Mandeljc

      Rok Mandeljc - 2022-01-14

      So as you can see, gi is not available in your python 3.6.3, which cdemu is using.

      When you say gi is installed, what exactly is installed? Do you have python3-specific package installed (on regular debian that would be python3-gi)?

       
  • retnev

    retnev - 2022-01-14

    It is installed for Python3

    $apt install python3-gi
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    python3-gi is already the newest version (3.22.0-2).
    
     

    Last edit: retnev 2022-01-14
    • Rok Mandeljc

      Rok Mandeljc - 2022-01-14

      What is the output of dpkg -s python3?

      And what do you get if you run python3, then run:

      import sys
      print(sys.path)
      
       
  • retnev

    retnev - 2022-01-14

    First Question

    # dpkg -s python3
    Package: python3
    Status: install ok installed
    Priority: optional
    Section: python
    Installed-Size: 67
    Maintainer: Matthias Klose <doko@debian.org>
    Architecture: amd64
    Multi-Arch: allowed
    Source: python3-defaults
    Version: 3.5.3-1
    Replaces: python3-minimal (<< 3.1.2-2)
    Provides: python3-profiler
    Depends: python3.5 (>= 3.5.3-1~), libpython3-stdlib (= 3.5.3-1), dh-python
    Pre-Depends: python3-minimal (= 3.5.3-1)
    Suggests: python3-doc (>= 3.5.3-1), python3-tk (>= 3.5.3-1~), python3-venv (>= 3.5.3-1)
    Description: interactive high-level object-oriented language (default python3 version)
     Python, the high-level, interactive object oriented language,
     includes an extensive class library with lots of goodies for
     network programming, system administration, sounds and graphics.
     .
     This package is a dependency package, which depends on Debian's default
     Python 3 version (currently v3.5).
    

    Second Question

    # python3
    Python 3.6.3 (default, Dec 17 2021, 00:18:20) 
    [GCC 6.3.0 20170516] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> print(sys.path)
    ['', '/usr/local/lib/python36.zip', '/usr/local/lib/python3.6', '/usr/local/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/site-packages']
    >>> 
    
     
    • Rok Mandeljc

      Rok Mandeljc - 2022-01-14

      OK, so do you see what your problem is?

      You are using a distribution that has python 3.5.3 as the packaged python version, and so the gi that is packaged in python3-gi is installed for that python (into /usr/lib/python3/dist-packages/gi, as per https://packages.debian.org/stretch/amd64/python3-gi/filelist).

      Your system, however, is using python 3.6.3 as its default python, and therefore does not have gi available. So you can either:
      a) install gi for your python 3.6.3
      b) make python 3.5.3 the default python again
      c) change the shebang in /usr/local/bin/cdemu to use python3.5 instead of just python3

       
  • retnev

    retnev - 2022-01-17

    Thanks a lot.
    I changed the shebang and now it works.
    Regarding Python:
    I have only two problems on Linux as syadmin.
    They are Python and systemD.
    Python must be heaven for a developer but it is truly hell for a user to maintain.
    I have no idea why gi suddenly moved from python3 to python 3.5 which is clearly what the problem was.
    Since this happened without any of my direct doing. No python installs or any cdemu installation. The system is basically hard locked as it is mission critical. The question is why Python seemingly moved the gi association from Version 3 to Version 3.5. ?

    This is the problem I have with the snake (Python).
    Things in it's coils just changes affiliations. I have this often with Python applications and it is a nightmare.
    systemD is another nutcase interfering (nothing to do with this problem) detrimentally with audio servers. Initially, once I removed all of systemD things started working.
    If I can get rid of Python and systemD Linux would be bliss. But these have become pervasive taking over everything.

    Python should do a better job not breaking application dependencies.

     

    Last edit: retnev 2022-01-17
    • Rok Mandeljc

      Rok Mandeljc - 2022-01-17

      I have no idea why gi suddenly moved from python3 to python 3.5 which is clearly what the problem was.

      gi didn't move anywhere - it is exactly where it was from the very beginning. Your distribution provides deb packages for python 3.5 it packages, which is also the default python3 for that distribution. So initially, things worked because python3 pointed to system python 3.5 that had gi installed.

      Then someone installed python3.6 on that system (placed in /usr/local), and made it the default python3 on the system. Which probably breaks all system-packaged python applications that make use of system-packaged python packages/libraries, because this python3.6 has different library search paths (and in case of binary extensions, the ones for python 3.5 may not be compatible with 3.6 ABI, anyway).

       
  • retnev

    retnev - 2022-01-19

    I managed to get 5.3 the default again by just changing the PATH order of /usr/bin and /usr/local/bin

    # python3
    Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
    [GCC 6.3.0 20170516] on linux
    

    Dont know if that will work in the end, but it is a quick way to get rid of the dreaded 3.6.

     

    Last edit: retnev 2022-01-19
  • retnev

    retnev - 2022-01-20

    Nope the path trick didnt work. I now have several broken applications. Python to me is irresponsible software. No backward compatibility between versions and if no backward compatibility, the user is not informed that that would be the case.
    I really dont like the snake. I honestly dont know how the new version got onto my system. as all automatic updates were switched off and I didnt install anything before this problem started happening.

    Anyway I know this is off topic, but if you know of an easy way to downgrade I would appreciate it as the online Python solutions are convoluted and inconclusive.
    I want to downgrade from 3.6.3 to 3.53.
    It seems 3.6.3 executes from /usr/local/bin, which usually means it was installed from source. I am sure I did not do that ..weird.

     
  • retnev

    retnev - 2022-01-22

    Anyway thanks for all the help.
    Cdemu is one of the greatest Linux applications and I appreciate it very much.

     

Log in to post a comment.