cv2.error: OpenCV(3.4.3) (-215:Assertion failed) !empty() in function Would anyone have a tip on how to fix this empty function error in OpenCV? I am attempting to follow the guides on OpenCV.org

The script will detect a face in an image and draw boxes around detections.

import numpy as np
import cv2 as cv



face_cascade = cv.CascadeClassifier('haarcascade_frontalface_alt.xml')

img = cv.imread('images/1.png')
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)

faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for (x,y,w,h) in faces:
    cv.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
    roi_gray = gray[y:y+h, x:x+w]
    roi_color = img[y:y+h, x:x+w]


cv.imshow('img',img)
cv.waitKey(0)
cv.destroyAllWindows()


I get an error:

&gt;&gt;&gt; 
=== RESTART: C:/Users/Desktop/distance-to-camera/selectHaar2.py ===
Traceback (most recent call last):
  File "C:/Users/Desktop/distance-to-camera/selectHaar2.py", line 11, in &lt;module&gt;
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1698: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'
I think this may be due to the fact that XML file is missing or the path to it is incorrect. Could you please check that? Maybe you coul try with the full path for the haarcascade_frontalface_alt.xml file.