last day (15 days later) » 

02:19
0
Q: After installing OpenCV, the qr code detector is missing: AttributeError: module 'cv2' has no attribute 'QRCodeDetector'

PedroskiI am dabbling with qr codes in Python. I installed like this: sudo apt install opencv-python3 I am following the instructions here. When I get to: detector = cv2.QRCodeDetector() I get this error in the Python shell: detector = cv2.QRCodeDetector() Traceback (most recent call last): File "<...

Which version of opencv did you get? QR Code reader need version 4.0 or newer. I know that pip3 install opencv-contrib-python give a recent version. I don't now for the apt version. However I only found a python3-opencv package not opencv-python3.
How would I get the version? I suppose it is fairly recent, from the Ubuntu repositories, but maybe not the very latest version. I don't really need cutting-edge stuff. I tried pip3 install python3-opencv but this also fails: not found error.
pip doesn't have a package python3-opencv, that's the name of the apt package. There is many pip package that install opencv, personnaly I used opencv-contrib-python. Also to get the opencv version you can run import cv2 in a python interpreter, then print cv2.version.opencv_version
Also note that, when you don't find a package, the seach command is useful to find the exact name, apt search <some keyword> or pip3 search <some keyword>.
Thank you very much! pip3 search opencv (I didn't know that) shows me many many packages!! How can I get them all?
pip3 install opencv-python fails with the error: ModuleNotFoundError: No module named 'skbuild'
PyPI FAQ provide the solution to that error
it says that your pip install isn't up to date
02:22
pip3 install opencv-contrib-python is working, but the download is slow. 6KB/s When its loaded I will try again, see if the detector works! Thank you very much for your help and advice!
pip install --upgrade pip
I know, I read that, but pip will not upgrade!! I tried that yesterday!
Yeah I'm not sure but I think the contrib version is may be havier with more modules included
Thank you again for your advice!
Ok, that's kind of problematic
You're welcome
03:17
Ok, the download finally finished, I restarted the Python shell, detector = cv2.QRCodeDetector() works now, no problem!! Thanks again for your help!
03:29
Great, have fun :)

last day (15 days later) »