cx_freeze and matplotlib

F

Flavio

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.py", 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\share\matplotlib\matplotlibrc')

setup( console = ["simple_plot.py"],
data_files = [("matplotlibdata", 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.
 
S

Serge Orlov

Flavio said:
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.py", 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.

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.
 
F

Flavio

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top