[Solved] Import cv2- no module exists error while deploying

I hosted on streamlit sharing,
so change the requirements.txt as follows

numpy
opencv-python-headless

This successfully worked for me, Hope this helps @aniketwattamwar.

By the way while running the code I encountered few errors:

  1. In Image Processing
    Contours
    ValueError: not enough values to unpack (expected 3, got 2)

  2. In Feature Detection in images
    SIFT
    AttributeError: module ‘cv2.cv2’ has no attribute ‘xfeatures2d’

After fixing the error and successfully deploying, please edit the title and add [Solved] at the beginning, it will be helpful for similar error encounters.

1 Like