cx_freeze and matplotlib

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Flavio

    #1

    cx_freeze and matplotlib


    I am trying to freeze an application which imports matplotlib. It all
    works fine on the machine where it was frozen. The executable runs
    without a glitch.

    But when I move the directory containing the frozen executable and
    other libs to a new machine, I get the following error:

    Traceback (most recent call last):
    File
    "/home/fccoelho/Downloads/cx_Freeze-3.0.2/initscripts/Console.py",
    line 26, in ?
    File "epigrass.p y", line 5, in ?
    File "Epigrass/manager.py", line 7, in ?
    File "Epigrass/simobj.py", line 4, in ?
    File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
    457, in ?
    try: return float(s)
    File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
    245, in wrapper
    if level not in self.levels:
    File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
    319, in _get_data_path
    Return the string representing the configuration dir. If s is the
    RuntimeError: Could not find the matplotlib data files

    Matplotlib can't find its data files.
    Apparently this problem comes up in py2exe as well and it is handled
    like this:

    from distutils.core import setup
    import glob
    import py2exe

    data = glob.glob(r'C:\ Python23\share\ matplotlib\*')
    data.append(r'C :\Python23\shar e\matplotlib\ma tplotlibrc')

    setup( console = ["simple_plot.py "],
    data_files = [("matplotlibdat a", data)],
    )

    This is the only thing I need to solve before I can distribute my
    frozen package, so please help me here. There must be a way since the
    frozen works in the original machine but not on the new Which also has
    the same version of matplotib installed.

  • Serge Orlov

    #2
    Re: cx_freeze and matplotlib

    Flavio wrote:[color=blue]
    > I am trying to freeze an application which imports matplotlib. It all
    > works fine on the machine where it was frozen. The executable runs
    > without a glitch.
    >
    > But when I move the directory containing the frozen executable and
    > other libs to a new machine, I get the following error:
    >
    > Traceback (most recent call last):
    > File
    > "/home/fccoelho/Downloads/cx_Freeze-3.0.2/initscripts/Console.py",
    > line 26, in ?
    > File "epigrass.p y", line 5, in ?
    > File "Epigrass/manager.py", line 7, in ?
    > File "Epigrass/simobj.py", line 4, in ?
    > File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
    > 457, in ?
    > try: return float(s)
    > File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
    > 245, in wrapper
    > if level not in self.levels:
    > File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line
    > 319, in _get_data_path
    > Return the string representing the configuration dir. If s is the
    > RuntimeError: Could not find the matplotlib data files
    >
    > Matplotlib can't find its data files.[/color]

    I'm not familiar with cx_freeze, but have you told cx_freeze that you
    don't want to bundle matplotlib or cx_freeze has decided that
    matplotlib is not going to be bundled? That fact that matplotlib is
    loaded from site-package is pretty strange, standalone application are
    not supposed to depend on non-system packages.

    Comment

    • Flavio

      #3
      Re: cx_freeze and matplotlib

      My application needs needs matplotlib. So cx_Freeze bundles it in. But
      it only bundles matplotlib python modules, not its data files!

      In the original machine I believe that the frozen executable is somehow
      finding those datafiles in their original locations, which is not
      desirable, ecause the bundle should be completely independent of
      external files.

      Comment

      Working...