The command % python3 -c "import cv2" gives ModuleNotFoundError: No module named 'cv2' because the cv2 package is not installed at /usr/lib64, but rather % qlist opencv | grep cv2/__init__ /usr/lib/python3.6/site-packages/cv2/__init__.py Moving the directory cv2 under /usr/lib64 make cv2 work again. Reproducible: Always
After re-emerging it works with python-3.7 because in python-3.7 sys.path uses /usr/lib: % python3.7 -c "import sys; print(sys.path)" ['', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/lib/python3.7/site-packages'] but python-3.6 does not: % python3.6 -c "import sys; print(sys.path)" ['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/home/xxx/.local/lib64/python3.6/site-packages', '/usr/lib64/python3.6/site-packages'] By the way, cv2 is the only python package on my system installed to /usr/lib/python3.6/site-packages/.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e402fc2e336e59a514557c6c1bdb014cb590fad1 commit e402fc2e336e59a514557c6c1bdb014cb590fad1 Author: Ross Charles Campbell <rossbridger.cc@gmail.com> AuthorDate: 2020-12-24 06:05:46 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2020-12-27 04:34:08 +0000 media-libs/opencv: version bump, remove old - Added constraint on CPU flags on x86 - Also closed out bugs that wasn't reported reproducible on newer versions Closes: https://bugs.gentoo.org/751781 Closes: https://bugs.gentoo.org/703658 Closes: https://bugs.gentoo.org/706040 Closes: https://bugs.gentoo.org/721706 Closes: https://bugs.gentoo.org/689838 Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Ross Charles Campbell <rossbridger.cc@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/18801 Signed-off-by: Sam James <sam@gentoo.org> media-libs/opencv/Manifest | 4 ++-- ...{opencv-4.4.0-r1.ebuild => opencv-4.5.1.ebuild} | 26 +++++++++++++++------- 2 files changed, 20 insertions(+), 10 deletions(-)