Reputation: 21
I'm trying to build an exe file using cx_Freeze.
But when I run the resulting file I get an error:
FileNotFoundError: ..\build\exe.win-amd64-3.8\lib\scipy.libs
Please tell me how to fix this problem?
I run the following code:
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["torch", 'tensorflow']}
target = Executable(
script='sub.py'
)
setup(
name='my',
options={'build_exe': build_exe_options},
executables=[target]
)
Upvotes: 0
Views: 810
Reputation: 29
I could not find the scipy.libs, but even just making an empty file with that name helped
Upvotes: 0
Reputation: 2461
You can use the include_files
option of the build_exe
command. According to the cx_Freeze documentation, you can use a tuple (source, destination)
in the include_files
list to let cx_Freeze copy a file to a specific destination into the build directory:
this list will contain strings or 2-tuples for the source and destination; the source can be a file or a directory (in which case the tree is copied except for .svn and CVS directories); the target must not be an absolute path
Accordingly, try to add the following lines to your setup.py
file:
import os
import scipy
scipy_libs_source = os.path.join(os.path.dirname(os.path.dirname(scipy.__file__)), 'scipy.libs')
scipy_libs_destination = os.path.join('lib', 'scipy.libs')
include_files = [(scipy_libs_source, scipy_libs_destination)]
build_exe_options = {'include_files': include_files,
'packages': ['torch', 'tensorflow']}
Upvotes: 0
Reputation: 31
I had this exact problem, this is only a short term fix but if you search for 'scipy.libs' in your python install location 'site-packages' folder (or virtual environment if you're using one) and copy/paste it into the libs folder in your build it should solve the issue.
I'll edit my answer if I come across the root cause and a more permanent fix...
Hope this helps!
Upvotes: 3