473,287 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

_tkinter installation in python 2.5 on mandriva with a default 2.4

I'm running on Mandriva 2007 (2.6.17-5mdv) and thus have python2.4.3
installed by default,
I'm running code requiring yield(), so need python2.5 and have
installed this sucessfully, and linked appropriately to allow me to
start python2.5 by typing python2.5. However I'd like to use idle so
require to be able to import _tkinter.
I gather I need to modift the setup.py script in my python directory
but am wary of experimenting since I've had problems with damaging the
default tkinter installation before.
import Tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/lib-tk/Tkinter.py", line 38, in
<module>
import _tkinter # If this fails your Python may not be configured
for Tk
ImportError: No module named _tkinter
Should I need to download a later version of tkinter and/or should I
alter setup.py in my python install directory and then remake?
If the former how do I ensure I don't overwrite the original tkinter
install thus damaging the many mandriva utilities that rely on
python2.4.3 and if the later what should I be looking for within the
python2.5 installation to point to and what alterations within
setup.py are required?

Oct 30 '07 #1
9 2240
Should I need to download a later version of tkinter and/or should I
alter setup.py in my python install directory and then remake?
Neither, nor. You need the Tk header files installed; they probably
come in a package called libtk8.4-dev or some such in your system.
If they are present when setup.py runs, _tkinter will get built
automatically. If you don't have the header files of Tk installed,
no amount of fiddling with setup.py, or getting alternative sources
of tkinter, will actually get you a _tkinter module.

HTH,
Martin
Oct 30 '07 #2
On 30 Oct, 22:36, "Martin v. Löwis" <mar...@v.loewis.dewrote:
Should I need to download a later version of tkinter and/or should I
alter setup.py in my python install directory and then remake?

Neither, nor. You need the Tk header files installed; they probably
come in a package called libtk8.4-dev or some such in your system.
If they are present when setup.py runs, _tkinter will get built
automatically. If you don't have the header files of Tk installed,
no amount of fiddling with setup.py, or getting alternative sources
of tkinter, will actually get you a _tkinter module.

HTH,
Martin

There is indeed such package on the system: libtk8.4-
devel-8.4.13-1mdk, which installs.
However upon running make in the python2.5.1 download directory

INFO: Can't locate Tcl/Tk libs and/or headers
running build_scripts
The only file on the system before installing the above package with a
libtk name is libtk8.4.so.0 in /usr/lib
after the package is installed /usr/lib contains:

0 lrwxrwxrwx 1 root root 13 Oct 31 07:43 libtk8.4.so ->
libtk8.4.so.0*
969 -rwxr-xr-x 1 root root 986216 Apr 21 2006 libtk8.4.so.0*
1 -rwxr-xr-x 1 root root 119 Apr 21 2006 libtk.so*
183 -rw-r--r-- 1 root root 186092 Apr 21 2006 libtkstub8.4.a

however make still complains of the non existance of the the Tcl/Tk
libs and/or headers

copying these file to /usr/local/lib where python2.5 seems to be makes
no difference.


Oct 31 '07 #3
however make still complains of the non existance of the the Tcl/Tk
libs and/or headers
So where it tk.h located?

Regards,
Martin
Oct 31 '07 #4
So where it tk.h located?

tk.h is now in just about every directory called include that could in
anyway be connected with this and indeed it does appear in the make
file printout:

/usr/bin/install -c -m 644 ./Include/sysmodule.h /usr/local/include/
python2.5
/usr/bin/install -c -m 644 ./Include/timefuncs.h /usr/local/include/
python2.5
/usr/bin/install -c -m 644 ./Include/tk.h /usr/local/include/python2.5
/usr/bin/install -c -m 644 ./Include/token.h /usr/local/include/
python2.5
/usr/bin/install -c -m 644 ./Include/traceback.h /usr/local/include/
python2.5

however it still generates the same error message,
I've tried debugging setup.py in the distribution directory with idle
( python2.4.3 versions ) but not surprisingly that doesn't do anything
too impressive, as you would expect.
Short of stuffing lots of print statements in there to actual try and
locate the file names it's failing on I'm at a loss to see where to go
next.

Oct 31 '07 #5
tk.h is now in just about every directory called include that could in
anyway be connected with this and indeed it does appear in the make
file printout:

/usr/bin/install -c -m 644 ./Include/tk.h /usr/local/include/python2.5
How did you get tk.h into the Include directory? You shouldn't manually
copy files around; this will surely break your system and installation
procedures if you don't know exactly what you are doing.

What is the location that your Mandriva package installed tk.h to?
Short of stuffing lots of print statements in there to actual try and
locate the file names it's failing on I'm at a loss to see where to go
next.
tk.h is searched-for in detect_tkinter. Check whether tklib, tcllib,
tcl_includes and tk_includes all get set. This should take only
a single print statement.

Regards,
Martin
Oct 31 '07 #6
tk.h is searched-for in detect_tkinter. Check whether tklib, tcllib,
tcl_includes and tk_includes all get set. This should take only
a single print statement.

Regards,
Martin
Ok I've cleared my increasingly frantic copies out

[root@localhost python2.5]# find / -name tk.h
/usr/include/tk.h
/usr/include/tk8.4.13/generic/tk.h

The slightly more verbose setup.py now reports

lib_dir:['/usr/local/lib', '/lib64', '/usr/lib64', '/lib', '/usr/lib']
Inc_dir: ['./Include', '.', '/usr/local/include', '/home/chris/
Python-2.5.1/Include', '/home/chris /Python-2.5.1', '/usr/
include']
Those TK libraries tcllib=None tklib=None tcl_includes=None
tk_includes=None
INFO: Can't locate Tcl/Tk libs and/or headers

I don't understand why the headers report None as the file tk.h is
in /usr/include ... or is the lack of the word generic more of a
problem?

I also can't work out what the name of the actual libraries are: which
doesn't help much.

The fact that None is reported for everything is a bit confusing.


Oct 31 '07 #7
Those TK libraries tcllib=None tklib=None tcl_includes=None
tk_includes=None
This also contradicts your earlier statement that you have libtk8.4.so
on your machine.

I don't understand why the headers report None as the file tk.h is
in /usr/include ... or is the lack of the word generic more of a
problem?
Please read detect_tkinter in detail: if it already fails to find
tklib or tcllib, it won't check for header files at all.

You should now trace through find_library_file with
print statements. Check whether compiler.find_library_file
returns not None, if yes, report what it returns. Otherwise,
annotate compiler.find_library_file. Print compiler.find_library_file
to see what specific function it is; likely something in
unixccompiler.py.

If so, print out shared, dylib, static, and os.path.exists of each one.

HTH,
Martin
Oct 31 '07 #8
On 31 Oct, 18:46, "Martin v. Löwis" <mar...@v.loewis.dewrote:
Those TK libraries tcllib=None tklib=None tcl_includes=None
tk_includes=None

This also contradicts your earlier statement that you have libtk8.4.so
on your machine.

[chris@localhost Python-2.5.1]$ ls -las /usr/lib/libtk*.*
0 lrwxrwxrwx 1 root root 13 Oct 31 07:43 /usr/lib/libtk8.4.so ->
libtk8.4.so.0*
969 -rwxr-xr-x 1 root root 986216 Apr 21 2006 /usr/lib/libtk8.4.so.0*
1 -rwxr-xr-x 1 root root 119 Apr 21 2006 /usr/lib/libtk.so*
183 -rw-r--r-- 1 root root 186092 Apr 21 2006 /usr/lib/libtkstub8.4.a
lib_dir:['/usr/local/lib', '/lib64', '/usr/lib64', '/lib', '/usr/lib']
Inc_dir:['./Include', '.', '/usr/local/include', '/home/chris/
Python-2.5.1/Include', '/home/chris/Python-2.5.1', '/usr/include']
so if libtk is being looked for it should have found it.

and indeed it did!!
from the print in distutils in unixccompiler.py

shared=/usr/lib/libtk8.4.so
dylib=/usr/lib/libtk8.4.dylib
static=/usr/lib/libtk8.4.a

FOUND!:-/usr/lib/libtk8.4.so
tklib:-/usr/lib/libtk8.4.so
but no tcllib !!!
perhaps that's the problem? Did I assume that it was installed by the
tk mandriva module ?

Perhaps theres a libtcl module to load...
Indeed there is !

787 -rwxr-xr-x 1 root root 800132 Apr 21 2006 /usr/lib/libtcl8.4.so.
0*
1 -rwxr-xr-x 1 root root 122 Apr 21 2006 /usr/lib/libtcl.so*
75 -rw-r--r-- 1 root root 75232 Apr 21 2006 /usr/lib/
libtclstub8.4.a
It would seems so !

Thus after make,su, make install...

[root@localhost Python-2.5.1]# python2.5
Python 2.5.1 (r251:54863, Oct 30 2007, 19:01:24)
[GCC 4.1.1 20060724 (prerelease) (4.1.1-3mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import _tkinter

Thank you very much for your help Martin. much learned.
Nov 1 '07 #9
but no tcllib !!!
perhaps that's the problem? Did I assume that it was installed by the
tk mandriva module ?
I see. I would have never guessed that you can manage to install
Tk but not Tcl on Mandriva...

Regards,
Martin
Nov 1 '07 #10

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

Similar topics

0
by: Berthold Höllmann | last post by:
Hello, I'm trying to compile Python 2.3 on Solaris 8, but can't get _tkinter to work. I got errors about the ancient tcl/tk installed under /usr/local and installed an new one into the path...
2
by: Sebastian Stelzer | last post by:
Hi, I'am a beginner in Python and I have got a problem with the TKInter module. When I want to start e.g. pysol, I get following output: Traceback (most recent call last): File...
2
by: gaool | last post by:
Hello, I try to launch a Python script on SunOS system but I have this error: """Traceback (most recent call last): File "ihm1_1.py", line 3, in ? from Tkinter import * File...
0
by: mg | last post by:
Hello, First, I installed Python on a traditionnal default linux-x86 platform (tk.h is located in /usr/include) and I did not meet any problem. I can write the following instruction without...
1
by: Sorin Schwimmer | last post by:
Hi All, After a disaster in which I lost my whole harddrive, I decided to install the newest everything that I use. I put the latest Gentoo Linux, with gcc 4.1.1, installed tcl/tk 8.4.14 and...
4
sanjay123456
by: sanjay123456 | last post by:
Dear Friends , i am using mandriva - 2007 in this i have in cd /usr/java/jre1_5_0_08/ in this jre its have all bin ,lib and so on when i give folowing command on command prompt javac
1
by: Sue Velutty | last post by:
Hi, I'm having this errror when I try to run "import _tkinter" in python Python 2.2.2 (#1, Apr 5 2007, 12:58:53) on linux2 Type "help", "copyright", "credits" or "license" for more...
5
by: jgelfand | last post by:
I'm installing Python 2.4.4 on a CentOS release 4.6 (Final) 64-bit machine. Running "./configure --prefix="/ usr/local/yosi/ciao-4.0/ots" --enable-shared" appears to be fine, but I get the...
0
by: akineko | last post by:
Hello, I spent time today to investigate this. If you install Python with Tkinter from source, _tkinter is built into the Python executable and _tkinter.so is not generated *unless* "shared"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.