title: Pyinstaller cannot find libvlc.dll
body: <p>First, I know similar questions have been asked but I haven't been able to find a solution to my problem. Thank you for any help!</p>
  
  <p>I have been trying to create an executable using pyinstaller, and I'm having trouble getting pyinstaller to find the .dlls for libvlc. In particular: libvlc.dll and libvlccore.dll. These are in my VideoLAN\VLC directory, but I also copied all the dlls from my VideoLAN\VLC directory to my Compile directory, next to my test.py and test.spec files. I also added my VideoLAN\VLC directory to my environment variables in an attempt to help pyinstaller find them. 
  Despite this, when I run pyinstaller test.spec I get this warning:</p>
  
  <pre><code>48352 WARNING: lib not found: libvlccore.dll dependency of C:\Users\chipc\Desktop\Code\Python\KivyTest\KivyTut\Compile\libvlc.dll
  </code></pre>
  
  <p>The rest of the compile log can be seen here: <a href="https://pastebin.com/DJmkQ7nm" rel="nofollow noreferrer">https://pastebin.com/DJmkQ7nm</a></p>
  
  <p>When trying to run the generated test.exe, it gives me this:</p>
  
  <pre><code>Traceback (most recent call last):
  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 149, in __init__
  File "ctypes\__init__.py", line 356, in __init__
  OSError: [WinError 193] %1 is not a valid Win32 application
  
  During handling of the above exception, another exception occurred:
  Traceback (most recent call last):
  File "test.py", line 18, in &lt;module&gt;
  File "&lt;frozen importlib._bootstrap&gt;", line 983, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 967, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 677, in _load_unlocked
  File "c:\users\chipc\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
  exec(bytecode, module.__dict__)
  File "site-packages\vlc.py", line 207, in &lt;module&gt;
  File "site-packages\vlc.py", line 163, in find_lib
  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 151, in __init__
  __main__.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\chipc\\Desktop\\Code\\Python\\KivyTest\\KivyTut\\Compile\\dist\\test\\libvlc.dll'. Most probably this dynlib/dll was not found when the application was frozen.
  [16044] Failed to execute script test
  </code></pre>
  
  <p>In addition, the generated folder which includes test.exe does have libvlc.dll inside of it.</p>
  
  <p>Here is my test.spec file:</p>
  
  <pre><code># -*- mode: python ; coding: utf-8 -*-
  from kivy_deps import sdl2, glew
  block_cipher = None
  
  
  a = Analysis(['test.py'],
               pathex=[('C:\\Users\\chipc\\Desktop\\Code\\Python\\KivyTest\\KivyTut\\Compile'), ('C:\Program Files\VideoLAN\VLC')],
               binaries=[('./libvlc.dll', '.'), ('./axvlc.dll', '.'), ('./libvlccore.dll', '.'), ('./npvlc.dll', '.')],
               datas=[],
               hiddenimports=[],
               hookspath=[],
               runtime_hooks=[],
               excludes=[],
               win_no_prefer_redirects=False,
               win_private_assemblies=False,
               cipher=block_cipher,
               noarchive=False)
  a.datas += Tree('C:\\Program Files\\VideoLAN\\VLC\\plugins', prefix='plugins')
  pyz = PYZ(a.pure, a.zipped_data,
               cipher=block_cipher)
  exe = EXE(pyz,
            a.scripts,
            [],
            exclude_binaries=True,
            name='test',
            debug=False,
            bootloader_ignore_signals=False,
            strip=False,
            upx=True,
            console=True )
  coll = COLLECT(exe, Tree('C:\\Users\\chipc\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\site-packages\\kivy_deps'),
                 a.binaries,
                 a.zipfiles,
                 a.datas,
                 *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
                 strip=False,
                 upx=True,
                 name='test')
  </code></pre>
  
  <p>The program works in PyCharm. How can I get pyinstaller to find libvlc.dll?</p>
  
  <p>Just in case, here is is what my Compile directory looks like:</p>
  
  <pre><code>axvlc.dll
  libvlc.dll
  libvlccore.dll
  npvlc.dll
  test.py
  test.spec
  </code></pre>
  
  <p>Thanks for any help, I've been trying to figure this out for a couple of days now!</p>