title: Pyinstaller throwing AttributeError: 'NoneType' object has no attribute 'groups' error
body: <p>I am trying to create a simple standalone script with <code>pyinstaller</code>. The script only uses <code>pandas</code> and <code>pdfminer</code> packages. I have also created a fresh environment with only these two packages and their dependencies installed.
  I get the below error when running <code>pyinstaller --onefile ema_pdf_reader.spec</code> and my <code>.spec</code> file looks like this:</p>
  <pre><code># -*- mode: python ; coding: utf-8 -*-
  
  block_cipher = None
  
  
  a = Analysis(['ema_pdf_reader.py'],
               pathex=['/home/erik/PycharmProjects/simple_gui'],
               binaries=[],
               datas=[],
               hiddenimports=['pandas','pdfminer'],
               hookspath=[],
               runtime_hooks=[],
               excludes=[],
               win_no_prefer_redirects=False,
               win_private_assemblies=False,
               cipher=block_cipher,
               noarchive=False)
  pyz = PYZ(a.pure, a.zipped_data,
               cipher=block_cipher)
  exe = EXE(pyz,
            a.scripts,
            a.binaries,
            a.zipfiles,
            a.datas,
            [],
            name='ema_pdf_reader',
            debug=False,
            bootloader_ignore_signals=False,
            strip=False,
            upx=True,
            upx_exclude=[],
            runtime_tmpdir=None,
            console=True )
  </code></pre>
  <p>ERROR:</p>
  <pre><code>(clean_env) [erik@liara simple_gui]$ pyinstaller --onefile ema_pdf_reader.spec 
  34 INFO: PyInstaller: 3.6
  34 INFO: Python: 3.8.2 (conda)
  69 INFO: Platform: Linux-5.10.15-1-MANJARO-x86_64-with-glibc2.10
  72 INFO: UPX is not available.
  73 INFO: Extending PYTHONPATH with paths
  ['/home/erik/PycharmProjects/simple_gui',
   '/home/erik/PycharmProjects/simple_gui']
  73 INFO: checking Analysis
  73 INFO: Building Analysis because Analysis-00.toc is non existent
  73 INFO: Initializing module dependency graph...
  74 INFO: Caching module graph hooks...
  78 INFO: Analyzing base_library.zip ...
  2247 INFO: Processing pre-find module path hook   distutils
  2247 INFO: distutils: retargeting to non-venv dir '/home/erik/miniconda3/envs/clean_env/lib/python3.8'
  4327 INFO: Caching module dependency graph...
  4424 INFO: running Analysis Analysis-00.toc
  4448 INFO: Analyzing ema_pdf_reader.py
  5378 INFO: Processing pre-safe import module hook   six.moves
  6929 INFO: Processing pre-find module path hook   site
  6929 INFO: site: retargeting to fake-dir '/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/fake-modules'
  12802 INFO: Processing module hooks...
  12802 INFO: Loading module hook &quot;hook-xml.etree.cElementTree.py&quot;...
  12803 INFO: Loading module hook &quot;hook-numpy.py&quot;...
  12803 INFO: Loading module hook &quot;hook-pytz.py&quot;...
  12816 INFO: Loading module hook &quot;hook-pandas.py&quot;...
  13457 INFO: Loading module hook &quot;hook-distutils.py&quot;...
  13459 INFO: Loading module hook &quot;hook-pkg_resources.py&quot;...
  13672 INFO: Processing pre-safe import module hook   win32com
  13879 WARNING: Hidden import &quot;pkg_resources.py2_warn&quot; not found!
  13881 INFO: Excluding import '__main__'
  13882 INFO:   Removing import of __main__ from module pkg_resources
  13883 INFO: Loading module hook &quot;hook-pydoc.py&quot;...
  13883 INFO: Loading module hook &quot;hook-_tkinter.py&quot;...
  13974 INFO: checking Tree
  13979 INFO: checking Tree
  13983 INFO: Loading module hook &quot;hook-sysconfig.py&quot;...
  13993 INFO: Loading module hook &quot;hook-cryptography.py&quot;...
  14149 INFO: Loading module hook &quot;hook-setuptools.py&quot;...
  14570 INFO: Loading module hook &quot;hook-encodings.py&quot;...
  14619 INFO: Loading module hook &quot;hook-lib2to3.py&quot;...
  14621 INFO: Loading module hook &quot;hook-sqlite3.py&quot;...
  14665 INFO: Loading module hook &quot;hook-numpy.core.py&quot;...
  14666 INFO: MKL libraries found when importing numpy. Adding MKL to binaries
  14667 INFO: Loading module hook &quot;hook-xml.py&quot;...
  14790 INFO: Looking for ctypes DLLs
  Traceback (most recent call last):
    File &quot;/home/erik/miniconda3/envs/clean_env/bin/pyinstaller&quot;, line 11, in &lt;module&gt;
      sys.exit(run())
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/__main__.py&quot;, line 114, in run
      run_build(pyi_config, spec_file, **vars(args))
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/__main__.py&quot;, line 65, in run_build
      PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/build_main.py&quot;, line 734, in main
      build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/build_main.py&quot;, line 681, in build
      exec(code, spec_namespace)
    File &quot;ema_pdf_reader.spec&quot;, line 6, in &lt;module&gt;
      a = Analysis(['ema_pdf_reader.py'],
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/build_main.py&quot;, line 244, in __init__
      self.__postinit__()
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/datastruct.py&quot;, line 160, in __postinit__
      self.assemble()
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/build_main.py&quot;, line 440, in assemble
      ctypes_binaries = scan_code_for_ctypes(co)
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/depend/utils.py&quot;, line 143, in scan_code_for_ctypes
      binaries = _resolveCtypesImports(binaries)
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/depend/utils.py&quot;, line 317, in _resolveCtypesImports
      load_ldconfig_cache()
    File &quot;/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/depend/utils.py&quot;, line 400, in load_ldconfig_cache
      path = m.groups()[-1]
  AttributeError: 'NoneType' object has no attribute 'groups'
  </code></pre>
  <p>Do I need to specify some other settings in my .spec file? So far I just added external packages to hiddenimports, rest of the .spec file was auto generated with  <code>pyi-makespec --onefile ema_pdf_reader.py</code></p>
  <p>Script by it self runs fine and creating standalone scripts that only use standard libraries also works with no problem.</p>
  <p><strong>UPDATE 1:</strong></p>
  <p>The error must be due to ctype DLL detection. It happens when importing numpy as well. I have tried with different versions of pyinstaller (3.6 and 4.2) and the error persists. I also tried reinstalling pyinstaller with pip instead of conda and it didn't help.</p>
  <p><strong>UPDATE 2:</strong>
  Executing same procedure on a windows machine works as expected</p>