title: ImportError: cannot import name 'is_directory'
body: <p>I've been trying to read pdf pages as an image, for extraction purposes.</p>
  <p>I found that layoutparser serves this purpose by identifying blocks of text. However, when I try to Create a Detectron2-based Layout Detection Model, I encounter the following:</p>
  <pre><code>import layoutparser as lp
  model = lp.Detectron2LayoutModel( config_path ='lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config',
                               extra_config=[&quot;MODEL.ROI_HEADS.SCORE_THRESH_TEST&quot;, 0.65],
                               label_map={0: &quot;Text&quot;, 1: &quot;Title&quot;, 2: &quot;List&quot;, 3:&quot;Table&quot;, 4:&quot;Figure&quot;})
  </code></pre>
  <p>Error: [enter image description here][1]</p>
  <pre><code>ImportError                               Traceback (most recent 
  
  call last)
  &lt;ipython-input-16-eab7187a31c8&gt; in &lt;module&gt;()
        1 import layoutparser as lp
  ----&gt; 2 model = lp.Detectron2LayoutModel( config_path ='lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config',
        3                                  extra_config=[&quot;MODEL.ROI_HEADS.SCORE_THRESH_TEST&quot;, 0.65],
        4                                  label_map={0: &quot;Text&quot;, 1: &quot;Title&quot;, 2: &quot;List&quot;, 3:&quot;Table&quot;, 4:&quot;Figure&quot;})
        5 layout = model.detect(image) # You need to load the image somewhere else, e.g., image = cv2.imread(...)
  
  31 frames
  /usr/local/lib/python3.7/dist-packages/PIL/ImageFont.py in &lt;module&gt;()
       35 from . import Image
       36 from ._deprecate import deprecate
  ---&gt; 37 from ._util import is_directory, is_path
       38 
       39 
  
  ImportError: cannot import name 'is_directory' from 'PIL._util' (/usr/local/lib/python3.7/dist-packages/PIL/_util.py)
  </code></pre>