473,785 Members | 2,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pylab without X11

I want to use pylab (matplotlib) on a machine without X11. I'm trying to
generate onthefly graphics for an apache2 web service, so they do not
have to be displayed on this machine !

When i do
pylab.figure()
I get the error
TclError: couldn't connect to display ":0.0"

I tried setting the DISPLAY environment variable to "", ":0.0" but I got
the same error message.

Any help is very much appreciated.
Sep 30 '08 #1
3 2809
This may help you ... or not

You may have to change your backend :

p13 of the matplotlib user guide: backends
p17 how to change the backend in the matplotlibrc

An example of matplotlibrc ( backend choice is at the beginning ):
http://matplotlib.sourceforge.net/matplotlibrc

You may choose PS or SVG or pdf, there might be other possibilities, I
do not know
To save the file : savefig

Marc


Willem-Jan Vriend a écrit :
I want to use pylab (matplotlib) on a machine without X11. I'm trying to
generate onthefly graphics for an apache2 web service, so they do not
have to be displayed on this machine !

When i do
pylab.figure()
I get the error
TclError: couldn't connect to display ":0.0"

I tried setting the DISPLAY environment variable to "", ":0.0" but I got
the same error message.

Any help is very much appreciated.
Sep 30 '08 #2
This may help ... or not ( 2nd part )

try not to do pylab.figure()

in your script:
pylab.plot, or pylab.imshow or whatever you want to use
then
savefig("myFigu re.png") for example
do not use show()
in my case ( with the WXAgg backend ), it works, it generates the png file

Marc

Willem-Jan Vriend a écrit :
I want to use pylab (matplotlib) on a machine without X11. I'm trying to
generate onthefly graphics for an apache2 web service, so they do not
have to be displayed on this machine !

When i do
pylab.figure()
I get the error
TclError: couldn't connect to display ":0.0"

I tried setting the DISPLAY environment variable to "", ":0.0" but I got
the same error message.

Any help is very much appreciated.
Sep 30 '08 #3
Thanks that worked ! I changed the backend to Agg.

Allthough a problem there is that with the backend Agg you only can
write the resulting image to a file or a file like object, it does not
accept the (apache) request handler to write the file to. And I do not
want to save the file to disk first before sending to the client.

WJV

marc wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">This may
help you ... or not

You may have to change your backend :

p13 of the matplotlib user guide: backends
p17 how to change the backend in the matplotlibrc

An example of matplotlibrc ( backend choice is at the beginning ):
http://matplotlib.sourceforge.net/matplotlibrc

You may choose PS or SVG or pdf, there might be other possibilities, I
do not know
To save the file : savefig

Marc


Willem-Jan Vriend a écrit :
>I want to use pylab (matplotlib) on a machine without X11. I'm trying
to generate onthefly graphics for an apache2 web service, so they do
not have to be displayed on this machine !

When i do
pylab.figure()
I get the error
TclError: couldn't connect to display ":0.0"

I tried setting the DISPLAY environment variable to "", ":0.0" but I
got the same error message.

Any help is very much appreciated.

</div>
Oct 2 '08 #4

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

Similar topics

1
2697
by: jean.rossier | last post by:
Hello All, I am facing a problem while importing pylab library(in a .py program file) via web browser however the same program works when I execute it from the command prompt. my configuration : Fedora Core 3 Apache 2.0
3
4064
by: Dr. Colombes | last post by:
On my home laptop computer, I'm trying to install the appropriate modules so that Python version 2.3.3 and IDLE version 1.0.2 (with an "import matplotlib.matlab" statement) can produce nice MatLab-like plots. I have a matplotlib.matlab-capable Python set-up running OK on my office desktop, which I obtained after downloading and installing a few more modules (numarray and numeric, I think). Now I get the following message about...
2
7813
by: Charles Krug | last post by:
List: I'm trying to us pylab to see what I'm doing with some DSP algorithms, in case my posts about convolution and ffts weren't giving it away. I've been using pylab's plot function, but I'm finding it a bit cumbersome. It works, but if I switch from the interactive window to the plot window and back, the plot window gets trashed.
6
17694
by: googlinggoogler | last post by:
Hiya, I've got a PIC microcontroller reading me humidity data via rs232, this is in ASCII format. I can view this data easily using hyperterminal or pyserial and convert it to its value (relative humidty with ord(input)) But what im trying to do is plot the data in real time, ideally with pylab - as it looks simple to use and simple is the way i want to go! My code is below, it doesnt show a graph, I was wondering whether
2
1817
by: Gary Wessle | last post by:
Hi I use debian/testing linux Linux debian/testing 2.6.15-1-686 I found some duplicate files in my system, I don't if the are both needed, should I delete one of the groups below and which one? -rw-r--r-- 1 root root 80375 2006-01-24 00:28 /usr/lib/python2.3/site-packages/matplotlib/pylab.py -rw-r--r-- 1 root root 96202 2006-05-07 13:44 /usr/lib/python2.3/site-packages/matplotlib/pylab.pyc -rw-r--r-- 1 root root 96202 2006-05-07...
2
2721
by: timw.google | last post by:
Hi all. I installed matplotlib 0.87.3 under Python 2.4 on both Linux (FC3) and Windows XP Pro. On the linux install, I can import pylab, but when I try to do the same thing on the Windows installation, I get >>> from pylab import * Traceback (most recent call last): File "<pyshell#7>", line 1, in -toplevel-
0
1969
by: ehenlin | last post by:
Hi, How to make pylab work together with py2exe? Have anyone managed to build a stand alone exe with pylab package? I have made a small test script but that does not work. setup.py ------------
14
6754
by: amitsoni.1984 | last post by:
hi, I have some values(say from -a to a) stored in a vector and I want to plot a histogram for those values. How can I get it done in python. I have installed and imported the Matplotlib package but on executing the code =hist(eig, 10) # make a histogram I am getting an error saying "NameError: name 'hist' is not defined". Is there any other way to plot histograms over a given range?
1
2427
by: oyinbo55 | last post by:
I am trying to use the pylab plot command on my laptop running Ubuntu 6.06 (Dapper). Although the plot command works fine on my XP desktop at work, I cannot open the plot window on the laptop. I edited matplotlibrc to change interactive: to "True". In idle, I entered the commands: The terminal window closed abruptly when I typed the closing parenthesis. I have been warned not to use the show() command in interactive mode. I tried:
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9485
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,...
0
10356
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, 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...
0
10161
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 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...
1
10098
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,...
0
8986
agi2029
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...
0
6743
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();...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.