Cannot use createBackgroundSubtractorMOG2 function for cv2

I have downloaded the cv2 library for python and I am trying to use createBackgroundSubtractorMOG2 but I am getting an error back:

Cannot find reference 'createBackgroundSubtractorMOG2' in '__init__.py'

The current version of cv2 I am using is: 4.7.0

I downloaded cv2 by running the following commands:

pip install opencv-python
pip install opencv-contrib-python

What could be the possible reason why I can’t use this function?

I am following this article: Python OpenCV - Background Subtraction - GeeksforGeeks

that’s wrong. remove all of those. then install exactly one of them.