Can not import PyQt5 but python3-pyqt5 is installed

X-Post: https://sqa.stackexchange.com/q/50530/54112

I assume my problem depends on the fact that I don’t totally understand how TravisCI work.

The Python unittests on Travis raising an ImportError because of import PyQt5.

So I was modifying the .travis.yml in several ways and none of them works. All with the same result.

I used the install-before and the install section.
There I tried sudo apt install python3-pyqt5 (which I would prefer).
And I tried pip install pyqt5 and pip install -U pyqt5.

Travis use Ubuntu 20 LTS. I also installed this on a VM and checked out. A simple
sudo apt python3-pyqt5 and I can import PyQt5 without problems. So I assume on TravisCI something is different from a usual Ubuntu 20.

I am confused. Maybe this has something todo with the virtenv or another
part of Travis. Any ideas?

The original .travis.yml I used can be found in this PR and including the different versions (see the commits).

Additional information’s

I really need to avoid installing PyQt5 via pip because this causing problems on ppc64le architecture where PyQt5 can not be build. For example see python - AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel' for PyQt5 5.15.0 - Stack Overflow