473,856 Members | 1,634 Online
Bytes | Software Development & Data Engineering Community
+ 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

Traceback (most recent call last):
File "gcToCsv.py ", line 5, in ?
File "plot_output.py c", line 1, in ?
File "pylab.pyc" , line 1, in ?
File "matplotlib\pyl ab.pyc", line 194, in ?
File "matplotlib\axe s.pyc", line 46, in ?
File "matplotlib\dat es.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\zonei nfo"] } }
but still no joy.

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



Jul 18 '05 #1
2 6682
>>>>> "scott" == scott <sh*******@yaho o.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.py c", line 1, in ? File
scott> "pylab.pyc" , line 1, in ? File "matplotlib\pyl ab.pyc",
scott> line 194, in ? File "matplotlib\axe s.pyc", line 46, in ?
scott> File "matplotlib\dat es.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?

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.py c", line 1, in ?
File "pylab.pyc" , line 1, in ?
File "matplotlib\pyl ab.pyc", line 195, in ?
File "matplotlib\bac kends\__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.py c", line 1, in ?
File "pylab.pyc" , line 1, in ?
File "matplotlib\pyl ab.pyc", line 195, in ?
File "C:\PYTHON23\Li b\site-packages\matplo tlib\backends\_ _init__.py",
line 20,
in ?
globals(),local s(),[backend_name])
"C:\PYTHON23\Li b\site-packages\matplo tlib\backends\b ackend_agg.py",
85, in ?
from matplotlib.math text import math_parse_s_ft 2font
File "C:\PYTHON23\Li b\site-packages\matplo tlib\mathtext.p y", line
140, in ?
from matplotlib.pypa rsing 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

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

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 the instructions given by py2exe wiki about matplotlib and tried to convert to an exe file. It first said several modules were missing. I realized that those were modules that matplotlib or Numeric will try to import and then provide the codes on...
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 because in the file pytz/tzinfo.py, I see global variables _timedelta_cache, _datetime_cache, _ttinfo_cache, which are dictionnaries and are used as cache. I always thought that you must protect shared data with locks when multithreading, but I don't...
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 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",
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 on other comps... i used py2exe... i wrote a setup.py whose contents are : from distutils.core import setup import py2exe import matplotlib setup(console=, options={ 'py2exe': { 'packages' : ,
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). While I digged into the oslan database, I see the following: # Zone NAME GMTOFF RULES FORMAT Zone Asia/Calcutta 5:53:28 - LMT 1880 # Kolkata
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: In member function 'Py::Object Glyph::get_path(FT_FaceRec_* const&)': src/ft2font.cpp:441: error: 'FT_CURVE_TAG_CUBIC' was not declared in this scope
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 I attempt to run the exe created. In searching the web, it appears this is an issue when others tried to use py2exe as well. Unfortunately, the few hits I saw doesn't include enough details to inspire me as to what I should be doing in my
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 I can tell, pytz seems to be updated (fairly) regularly to the newest tzdata, but I don't want to have to update my pytz, just it's definitions. http://www.twinsun.com/tz/tz-link.htm says that pytz "compiles tz source into Python." Does this...
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 for this purpose but every time I try to make this exe using a setup file I get these errors. Final.py is my python code. Traceback (most recent call last): File "Final.py", line 5, in <module> File "pylab.pyc", line 1, in <module> File...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 we have to send another system

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.