Python Forum
PyInstaller fails after changing 32 to 64 bit
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyInstaller fails after changing 32 to 64 bit
#1
Hi
On Windows 10, I have an application that works when frozen with PyInstaller and Python 3.7.4 (32-bit). After upgrading to Python 3.8.0 (64-bit) with all corresponding modules and PyInstaller the frozen code now exhibits a DLL load failure saying the specified module could not be found?

Error:
C:\Playpen\kiwi\py38>kiwiCalling.exe Traceback (most recent call last): File "kiwiCalling.py", line 7, in <module> import gui1, gui2, finder File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "gui2.py", line 10, in <module> from scipy import signal File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\signal\__init__.py", line 289, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\signal\windows\__init__.py", line 41, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\signal\windows\windows.py", line 9, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\fftpack\__init__.py", line 99, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\fftpack\basic.py", line 12, in <module> ImportError: DLL load failed while importing _fftpack: The specified module could not be found. [312] Failed to execute script kiwiCalling
I have examined the warnings file and there is no warning for missing _fftpack. Also, I have looked at and compared the xref files for both the 3.7.4 and 3.8.0 builds and the output looks equivalent.

3.7.4 (32-bit) build:
Output:
... scipy.fftpack._fftpack c:\users\bayki\appdata\local\programs\python\python37-32\lib\site-packages\scipy\fftpack\_fftpack.cp37-win32.pyd imports: scipy.fftpack imported by: scipy.fftpack • scipy.fftpack.basic • scipy.fftpack.realtransforms ... scipy.fftpack.basic SourceModule imports: __future__ • atexit • numpy • scipy.fftpack • scipy.fftpack._fftpack • scipy.fftpack.helper imported by: scipy.fftpack • scipy.fftpack.pseudo_diffs • scipy.fftpack.realtransforms ...
3.8.0 (64-bit) build:
Output:
... scipy.fftpack._fftpack c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\scipy\fftpack\_fftpack.cp38-win_amd64.pyd imports: scipy.fftpack imported by: scipy.fftpack • scipy.fftpack.basic • scipy.fftpack.realtransforms ... scipy.fftpack.basic SourceModule imports: __future__ • atexit • numpy • scipy.fftpack • scipy.fftpack._fftpack • scipy.fftpack.helper imported by: scipy.fftpack • scipy.fftpack.pseudo_diffs • scipy.fftpack.realtransforms ...
The xref output indicates to me that PyInstaller found the DLL during the build process but somehow does not now associate it with the relative import code (line 12 in basic.py):
from . import _fftpack
Reply
#2
Ok, I have simplified the program down to one line and I still get the same DLL load failure with Python 3.8.0 (64 bit) and PyInstaller. My one-line program (bug.py) is:

from scipy import signal
Built with batch file:
Output:
C:\Users\bayki\AppData\Local\Programs\Python\Python38\Scripts\pyinstaller -F bug.py 2> bug_build.log
Error:
C:\Playpen\kiwi\py38\bug\dist>bug.exe Traceback (most recent call last): File "bug.py", line 1, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\signal\__init__.py", line 289, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\signal\windows\__init__.py", line 41, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\signal\windows\windows.py", line 9, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\fftpack\__init__.py", line 99, in <module> File "c:\users\bayki\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module exec(bytecode, module.__dict__) File "site-packages\scipy\fftpack\basic.py", line 12, in <module> ImportError: DLL load failed while importing _fftpack: The specified module could not be found. [412] Failed to execute script bug
The generated spec file was:
Output:
# -*- mode: python ; coding: utf-8 -*- block_cipher = None a = Analysis(['bug.py'], pathex=['C:\\Playpen\\kiwi\\py38\\bug'], binaries=[], datas=[], hiddenimports=[], 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='bug', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=True )
Reply
#3
Interesting, I changed my one-line program to simply:
import scipy
and do not get the problem here.
Reply
#4
when you build with pyinstaller it is not able to find the _fftpack as indicated by the last line.
Normally this is easily resolvable by including --hidden-import option (or editing the respective section in the spec file). However if you google it you will find that scipy.signal often cause similar problems and it's not always resolved with just the --hidden-import option. Or may require to specify a A LOT of scipy dlls. If it does not help you may extend the search path, like suggested in the docs and in one answer here:
https://stackoverflow.com/questions/4706...oad-failed
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  .exe created with pyinstaller fails to execute iankerr 5 6,730 Apr-20-2020, 03:38 PM
Last Post: steve_shambles

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020