473,473 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Matplotlib, py2exe and pytz

I am trying to convert a python app that uses matplotlib to a
standalone executable using py2exe.

After running py2exe and executing my app I get the following stack
trace:

Traceback (most recent call last):
File "gcToCsv.py", line 5, in ?
File "plot_output.pyc", line 1, in ?
File "pylab.pyc", line 1, in ?
File "matplotlib\pylab.pyc", line 194, in ?
File "matplotlib\axes.pyc", line 46, in ?
File "matplotlib\dates.pyc", line 94, in ?
File "pytz\__init__.pyc", line 53, in timezone
KeyError: 'UTC'

It appears that the instructions on the matplotlib web site and wiki
are incomplete and the pytz.zoneinfo package is not being included in
the finished dist directory.

I tried adding an opt line to setup.py
opts = {"py2exe": {"packages": ["pytz\zoneinfo"] } }
but still no joy.

Can someone tell me the correct setup.py file to use for including
matplotlib with an app using py2exe?

Thanks,

Scott

Jul 18 '05 #1
2 6654
>>>>> "scott" == scott <sh*******@yahoo.com> writes:

scott> I am trying to convert a python app that uses matplotlib to
scott> a standalone executable using py2exe.

scott> After running py2exe and executing my app I get the
scott> following stack trace:

scott> Traceback (most recent call last): File "gcToCsv.py", line
scott> 5, in ? File "plot_output.pyc", line 1, in ? File
scott> "pylab.pyc", line 1, in ? File "matplotlib\pylab.pyc",
scott> line 194, in ? File "matplotlib\axes.pyc", line 46, in ?
scott> File "matplotlib\dates.pyc", line 94, in ? File
scott> "pytz\__init__.pyc", line 53, in timezone KeyError: 'UTC'

scott> It appears that the instructions on the matplotlib web site
scott> and wiki are incomplete and the pytz.zoneinfo package is
scott> not being included in the finished dist directory.

In your script that you are trying to freeze, do,

import pytz
import dateutil

as a hint to py2exe that you want these modules. Does this help?

Does the script you are trying to freeze explicitly use matplotlib
date functionality?

JDH
Jul 18 '05 #2
I unzipped library.zip to see what compiled python files were included
in the zip.
As in the error stacktrace the Pytz.timezone package was not part of
the library.
After manually adding it and rezipping the library I ran into another
missing module, this time it was missing backend_agg

Traceback (most recent call last):
File "gcToCsv.py", line 5, in ?
File "plot_output.pyc", line 1, in ?
File "pylab.pyc", line 1, in ?
File "matplotlib\pylab.pyc", line 195, in ?
File "matplotlib\backends\__init__.pyc", line 20, in ?
ImportError: No module named backend_agg

I added that module and then saw that it was missing pyparsing
Traceback (most recent call last):
File "gcToCsv.py", line 5, in ?
File "plot_output.pyc", line 1, in ?
File "pylab.pyc", line 1, in ?
File "matplotlib\pylab.pyc", line 195, in ?
File "C:\PYTHON23\Lib\site-packages\matplotlib\backends\__init__.py",
line 20,
in ?
globals(),locals(),[backend_name])
File
"C:\PYTHON23\Lib\site-packages\matplotlib\backends\backend_agg.py",
line
85, in ?
from matplotlib.mathtext import math_parse_s_ft2font
File "C:\PYTHON23\Lib\site-packages\matplotlib\mathtext.py", line
140, in ?
from matplotlib.pyparsing import Literal, Word, OneOrMore,
ZeroOrMore, \
ImportError: No module named pyparsing

After that I stopped adding modules as I figured the problem was more
involved than just missing 1 or 2 modules.

My app just takes a set of data and plots it using the library. It does
not use matplotlib date functionality explicitly, it converts a list of
datatimes to a list of elapsed times (numbers of seconds) and plots
data against these floats.

The setup.py file I used was the one in the matplotlib documentation. I
then added the opt line to try and force the inclusion of that package.
I am relatively new to Python programming coming most recently from a
Java programming background, and was wondering why python does not have
the concept of a python archive much like a "jar" file in Java.
That would make all of these problems fairly trivial, inclusion of
dependant libraries would just be a matter of having the appropriate
"Python ARchive in a directory in the PYTHON_PATH so that it could be
loaded.

Thanks for any help on resolving my py2exe problems.

Scott Snyder

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Oh Kyu Yoon | last post by:
Hi! I am making a small program using boa constructor. This program converts fine into an exe file using py2exe. Then, I embedded a figure canvas from matplotlib in a wxpython panel. I followed...
5
by: nicolas_riesch | last post by:
Does someone know if the module pytz (http://sourceforge.net/projects/pytz/) is thread-safe ? I have not seen it explicitely stated, and just wanted to be sure, as I want to use it. That's...
2
by: Flavio | last post by:
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...
3
by: vajratkarviraj | last post by:
i hav python2.5, matplotlib0.90.1, and py2exe for python 2.5 all on windows xp... i hav a python program(letsc.py) which uses the matplotlib package... and i want 2 make an exe of it for distribution...
2
by: Sanjay | last post by:
Hi All, Using pytz, I am facing a problem with Asia/Calcutta, described below. Asia/Calcutta is actually IST, which is GMT + 5:30. But while using pytz, it was recognized as HMT (GMT + 5:53)....
2
by: John | last post by:
I'm trying to install matplotlib and currently getting the below error. I searched the group and google and couldn't find anything similar... Any ideas? Thanks in advance! src/ft2font.cpp:...
4
by: John Henry | last post by:
Has anybody been able to create an exe of their python applications involving matplotlib using pyinstall (ver 1.3)? I am getting a: RuntimeError: Could not find the matplotlib data files when...
1
by: _robby | last post by:
I am looking at using pytz in a scheduling application which will be used internationally. I would like to be able to update the definition files that pytz uses monthly or bi-monthly. As far as...
0
by: PamMish1982 | last post by:
Hi all, I have recently started using Python and I am trying to make a GUI out of Tkinter. I am using matplotlib for the graphic purposes. I have to make a exe file from this code. I use py2exe...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.