Reputation: 33920
For some reason when importing the seaborn
package, and making an executable (.exe) will give following ImportError. How to troubleshoot this?
Traceback (most recent call last):
File "C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\cx_Fr
eeze\initscripts\__startup__.py", line 12, in <module>
__import__(name + "__init__")
File "C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\cx_Fr
eeze\initscripts\Console.py", line 21, in <module>
scriptModule = __import__(moduleName)
File "GUI.py", line 22, in <module>
import seaborn as sns
File "C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\seabo
rn\__init__.py", line 9, in <module>
from .linearmodels import *
File "C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\seabo
rn\linearmodels.py", line 8, in <module>
from scipy.spatial import distance
File "C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\scipy
\spatial\__init__.py", line 93, in <module>
from .ckdtree import *
ImportError: No module named 'scipy.spatial.ckdtree'
scipy 0.18.1
Renamed the finder.IncludePackage("scipy.lib")
in the cx_Freeze/hooks.py
to finder.IncludePackage("scipy._lib")
as instructed in the answer of the SO Question "Cx_freeze ImportError no module named scipy"
import os
import sys
from cx_Freeze import setup, Executable
os.environ['TCL_LIBRARY'] = r"C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = r"C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\tcl\tk8.6"
base = None
options = {
'build_exe': {
'excludes': ['gtk', 'PyQt4', 'Tkinter'],
'packages': ['scipy'],
'includes': ['scipy.spatial.ckdtree'],
}
}
executables = [
Executable('GUI.py', base=base)
]
setup(name='GUI',
version='0.1',
description='GUI test',
executables=executables,
options=options
)
Upvotes: 3
Views: 3081
Reputation: 292
Try renaming cKDTree.cp35-win_amd64.pyd
to ckdtree.cp35-win_amd64.pyd
. This works for my case.
The file shoudld be under your build path, such as build\exe.win-amd64-3.5\scipy\spatial\
.
Upvotes: 6