Pyatspi module is installed in CI but cannot be loaded

My CI file below

  stage: test
    - build
    - apt-get update && apt-get install libcairo2-dev libgirepository1.0-dev libgtk-3-dev python3-pyatspi python3-dogtail gnome-icon-theme gsettings-desktop-schemas xvfb -y
    - gsettings set org.gnome.desktop.interface toolkit-accessibility true
    - pip3 install pycairo PyGObject
    - pip3 install setuptools
    - pip3 install dogtail
    - cd tests/gui
    - apt list | grep pyatspi
    - python3 -c "help('modules pyatspi')"
    - xvfb-run python3

installs the module pyatspi and the log shows that it has been installed yet, as shown below, it is not visible to Python???

$ apt list | grep pyatspi
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
python3-pyatspi/stable,now 2.38.1-1 all [installed,automatic]
$ python3 -c "help('modules pyatspi')"
Here is a list of modules whose name or summary contains 'pyatspi'.
If there are any, enter a module name to get more help.

How can this be?

Solved it!

Added the line following lines in gitlab-ci.yml

    - updatedb
    - locate pyatspi

    - python3 -c 'import site; print(site.getsitepackages())'

The site packages check returned

But locate pyatspi returned (see the locate command)


Clearly apt-get installed python3-pyatspi in a location unknown to Python, so I added a sym-link

  - ln -s /usr/lib/python3/dist-packages/pyatspi /usr/local/lib/python3.10/site-packages/pyatspi

Of course the symbolic link is a hack. There’s a proper solution on stackoverflow. Still trying to wrap my mind around it.

1 Like