It seems it is a py27/py3 compatibility issue since if I make the changes
to the files as in the attached and use a python 3.3 conda environment, it
works fine.  On my project I have to use py2.7 though since wxpython hasn't
been ported to py3 yet.  Thus we need to get this fixed.

Ian




On Thu, Jul 3, 2014 at 9:52 AM, Ian Bell <ian.h.b...@gmail.com> wrote:

> I am spending hours and hours trying to debug packaging with cx_Freeze and
> making no progress.
>
> Can anyone package a newer (1.8.1) version of numpy?  I have attached
> minimal set of files needed to demonstrate the problem.  I am using the
> conda install of python for what its worth.
>
> cx_Freeze is skipping some required imports (the _methods in this case).
> When I try to run the generated executable, I get the traceback:
>
> C:\Users\Belli\Desktop\failing_cx_freeze\demo>demo
> Traceback (most recent call last):
>   File "C:\Miniconda\lib\site-packages\cx_Freeze\initscripts\Console.py",
> line 27, in <module>
>     exec code in m.__dict__
>   File "demo.py", line 1, in <module>
>   File "C:\Miniconda\lib\site-packages\numpy\__init__.py", line 168, in
> <module>
>     from . import add_newdocs
>   File "C:\Miniconda\lib\site-packages\numpy\add_newdocs.py", line 13, in
> <module>
>     from numpy.lib import add_newdoc
>   File "C:\Miniconda\lib\site-packages\numpy\lib\__init__.py", line 8, in
> <module>
>     from .type_check import *
>   File "C:\Miniconda\lib\site-packages\numpy\lib\type_check.py", line 11,
> in <module>
>     import numpy.core.numeric as _nx
>   File "C:\Miniconda\lib\site-packages\numpy\core\__init__.py", line 11,
> in <module>
>     from . import numeric
>   File "C:\Miniconda\lib\site-packages\numpy\core\numeric.py", line 1500,
> in <module>
>     from .arrayprint import array2string, get_printoptions,
> set_printoptions
>   File "C:\Miniconda\lib\site-packages\numpy\core\arrayprint.py", line 23,
> in <module>
>     from .fromnumeric import ravel
>   File "C:\Miniconda\lib\site-packages\numpy\core\fromnumeric.py", line
> 12, in <module>
>     from . import _methods
> ImportError: cannot import name _methods
>
>
> My arch:
>
> C:\Users\Belli\Desktop\failing_cx_freeze\demo>python
> Python 2.7.6 |Continuum Analytics, Inc.| (default, May 27 2014, 15:00:33)
> [MSC v.1500 64 bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> Anaconda is brought to you by Continuum Analytics.
> Please check out: http://continuum.io and https://binstar.org
> >>> import numpy
> >>> numpy.__version__
> '1.8.1'
>
> If I modify the setup.py file to include a few missing .py files,
>
> includes =
> ['numpy.core._methods','numpy.core.scalarmath','numpy.linalg._umath_linalg','numpy.lib.format']
>
> I now get the error
>
> C:\Users\Belli\Desktop\failing_cx_freeze\demo>demo
> Traceback (most recent call last):
>   File "C:\Miniconda\lib\site-packages\cx_Freeze\initscripts\Console.py",
> line 27, in <module>
>     exec code in m.__dict__
>   File "demo.py", line 1, in <module>
>   File "C:\Miniconda\lib\site-packages\numpy\__init__.py", line 178, in
> <module>
>     from .core import *
> AttributeError: 'module' object has no attribute 'sys'
>
> ARGH!
>
import numpy
print('hi')
print(numpy.sum(numpy.ones((100,1))))
from cx_Freeze import setup, Executable
import sys, os, shutil

sys.argv += ['build','--build-exe=demo']
# Process the includes, excludes and packages first
include_files = []
includes = []
excludes = ['scipy']
packages = ['numpy']
path = []

# The setup for cx_Freeze is different from py2exe. Here I am going to
# use the Python class Executable from cx_Freeze

base = None
#~ if sys.platform == "win32":
    #~ base = "Win32GUI"

GUI2Exe_Target_1 = Executable(
    # what to build
    script = "demo.py",
    initScript = None,
    base = base,
    targetDir = r"demo",
    targetName = "demo.exe",
    compress = True,
    copyDependentFiles = False,
    appendScriptToExe = False,
    appendScriptToLibrary = False,
    icon = None
    )

setup(
    
    version = "1.0",
    description = "No Description",
    author = "No Author",
    name = "cx_Freeze Sample File",
    
    options = {"build_exe": {"include_files": include_files,
                             "includes": includes,
                             "excludes": excludes,
                             "packages": packages,
                             "path": path
                             }
               },
                           
    executables = [GUI2Exe_Target_1]
    )
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
cx-freeze-users mailing list
cx-freeze-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cx-freeze-users

Reply via email to