cxfreeze

Hi,

I want to build executables from python scripts that call matplotlib under linux. To this end I have installed cxfreeze on my
SuSE 11.2 machine

I have tried two methods
  1. Execute the command 'cxfreeze script.py'
and
  2. Creating a setup.py script
    import cx_Freeze
    import sys
    base = None
    if sys.platform == "win32":
        base = "Win32GUI"

    executables = [
            cx_Freeze.Executable("script.py", base = base)
    ]
    cx_Freeze.setup(
            name = "script",
            version = "0.1",
            description = "Sample matplotlib script",
            executables = executables)
  and then execute 'python setup.py build'

In both cases I get an executable, but when executed I get the following error
  RuntimeError: Could not find the matplotlib data files

The version of matplotlib I am running is 0.99.1.1 and Python 2.6.2

Does anyone have any thoughts/suggestions to resolve this, thanks

Peter

I have no experience with cx_freeze, but the page on packaging matplotlib with py2exe may be relevant. You do need to find a way to convince cx_freeze to include the data files and then a way for matplotlib to find them at run time.

Mike

Peter Bloomfield wrote:

···

Hi,

I want to build executables from python scripts that call matplotlib under linux. To this end I have installed cxfreeze on my SuSE 11.2 machine

I have tried two methods
  1. Execute the command 'cxfreeze script.py'
and
  2. Creating a setup.py script
    import cx_Freeze
    import sys
    base = None
    if sys.platform == "win32":
        base = "Win32GUI"

    executables = [
            cx_Freeze.Executable("script.py", base = base)
    ]
    cx_Freeze.setup(
            name = "script",
            version = "0.1",
            description = "Sample matplotlib script",
            executables = executables)
  and then execute 'python setup.py build'

In both cases I get an executable, but when executed I get the following error
  RuntimeError: Could not find the matplotlib data files

The version of matplotlib I am running is 0.99.1.1 and Python 2.6.2

Does anyone have any thoughts/suggestions to resolve this, thanks

Peter

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

I managed to resolve it, by following Mike's hint thanks Mike.

It was simply to change the setup.py script to
  import cx_Freeze
  import sys
  import matplotlib
  base = None
  if sys.platform == "win32":
  base = "Win32GUI"

  executables = [
    cx_Freeze.Executable("script.py", base = base)
  ]
  cx_Freeze.setup(
    name = "script",
        options = {"build_exe": {"include_files":[( matplotlib.get_data_path(),"mpl-data")],}},
    version = "0.1",
    description = "Sample matplotlib script",
    executables = executables)

Peter

···

On Friday 19 March 2010, Michael Droettboom wrote:

I have no experience with cx_freeze, but the page on packaging
matplotlib with py2exe may be relevant. You do need to find a way to
convince cx_freeze to include the data files and then a way for
matplotlib to find them at run time.

Mike

Peter Bloomfield wrote:
> Hi,
>
> I want to build executables from python scripts that call matplotlib
> under linux. To this end I have installed cxfreeze on my SuSE 11.2
> machine
>
> I have tried two methods
> 1. Execute the command 'cxfreeze script.py'
> and
> 2. Creating a setup.py script
> import cx_Freeze
> import sys
> base = None
> if sys.platform == "win32":
> base = "Win32GUI"
>
> executables = [
> cx_Freeze.Executable("script.py", base = base)
> ]
> cx_Freeze.setup(
> name = "script",
> version = "0.1",
> description = "Sample matplotlib script",
> executables = executables)
> and then execute 'python setup.py build'
>
> In both cases I get an executable, but when executed I get the following
> error RuntimeError: Could not find the matplotlib data files
>
> The version of matplotlib I am running is 0.99.1.1 and Python 2.6.2
>
> Does anyone have any thoughts/suggestions to resolve this, thanks
>
>
> Peter