3

I am trying to freeze a bunch of scripts using cz_freeze but I get this error message (seemingly due to statsmodels.api) when running the .exe:

I was unable to copy text from the dialog window, so the image will have to do. My apologies.

My cx_freeze build script:

# -*- coding: utf-8 -*-
"""
Created on Thu Mar 30 11:04:36 2017

@author: Max
"""

import sys
from os import environ
from os.path import dirname
from cx_Freeze import setup, Executable
import scipy
scipy_path = dirname(scipy.__file__)


# Set the TCL and TK library explicitly (it seems like the python 3.6 causes
# errors otherwise):
environ['TCL_LIBRARY'] = r'C:\ProgramData\Anaconda3\tcl\tcl8.6'
environ['TK_LIBRARY'] = r'C:\ProgramData\Anaconda3\tcl\tk8.6'


#Inclusion of dll files to fix tkinter import:
include_files = [r'C:\ProgramData\Anaconda3\DLLs\tcl86t.dll', 
                 r'C:\ProgramData\Anaconda3\DLLs\tk86t.dll', 
                 scipy_path]
#Inclusion of modules that need to be explicitly imported for some reason:
packages = []#['pyteomics']

#Dependencies that are not implicitly detected:
build_exe_options = {'includes': ['numpy.core._methods', 'numpy.lib.format'], 
                     'excludes': [],
                     'include_files': include_files, 
                     'packages': packages}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == 'win32':
    base = 'Win32GUI'

setup(  name = 'Davidek beta 1.1.1',
        version = '1.1.1',
        options = {'build_exe': build_exe_options},
        executables = [Executable('Davidek.py', base=base)])

The very humble import line:

import statsmodels.api as sm

I am running Python 3.6.0 on 64-bit Windows 10. Any tips are greatly appreciated. Let me know if additional information is needed.

  • [This is a similar question](https://stackoverflow.com/questions/2223128/cx-freeze-importerror-cannot-import-name?rq=1) – lwileczek May 10 '18 at 16:32

0 Answers0