FAQ
I'm on a Red Hat 9 system, which has Python 2.2.2 installed, and I installed
2.3 separately into /home/rob/Python-2.3/ (creating the symbolic link
"py23" to point to my 2.3 installation). Now I'm trying to work out the
kinks in the process.

Unable to run Idle using 2.3 the way I've got things set up, I created a
super simple Tkinter test program that just pops up a Label widget. I
pasted below an example of how the RH-provided 2.2 runs the script without
incident, but running the script with 2.3 produces a traceback. If someone
can help me see the error of my ways, I'll be most appreciative.

[Wed Aug 27][03:01 PM] ~/Python-2.3/test $ python -V
Python 2.2.2
[Wed Aug 27][03:04 PM] ~/Python-2.3/test $ py23 -V
Python 2.3
[Wed Aug 27][03:01 PM] ~/Python-2.3/test $ py23 test2.py
Traceback (most recent call last):
File "test2.py", line 1, in ?
from Tkinter import Label
File "/home/rob/Python-2.3/Lib/lib-tk/Tkinter.py", line 38, in ?
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
[Wed Aug 27][03:01 PM] ~/Python-2.3/test $ python test2.py

-Rob
(mediocre with Python, incompetent with linux)

Search Discussions

  • Martin Franklin at Aug 28, 2003 at 7:42 am

    On Wednesday 27 August 2003 9:12 pm, Rob Andrews wrote:
    I'm on a Red Hat 9 system, which has Python 2.2.2 installed, and I
    installed 2.3 separately into /home/rob/Python-2.3/ (creating the symbolic
    link "py23" to point to my 2.3 installation). Now I'm trying to work out
    the kinks in the process.

    Unable to run Idle using 2.3 the way I've got things set up, I created a
    super simple Tkinter test program that just pops up a Label widget. I
    pasted below an example of how the RH-provided 2.2 runs the script without
    incident, but running the script with 2.3 produces a traceback. If someone
    can help me see the error of my ways, I'll be most appreciative.

    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ python -V
    Python 2.2.2
    [Wed Aug 27][03:04 PM] ~/Python-2.3/test $ py23 -V
    Python 2.3
    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ py23 test2.py
    Traceback (most recent call last):
    File "test2.py", line 1, in ?
    from Tkinter import Label
    File "/home/rob/Python-2.3/Lib/lib-tk/Tkinter.py", line 38, in ?
    import _tkinter # If this fails your Python may not be configured for
    Tk ImportError: No module named _tkinter
    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ python test2.py

    -Rob
    (mediocre with Python, incompetent with linux)
    Rob,

    I just finished building python 2.3 on my redhat 9 laptop... the first time I
    did the make it failed (near the end) because it couldn't find the Tk/Tcl
    libs.

    On my system they are in /usr/local/lib (because I built them myself)
    on your's I guess they would be in /usr/lib. So to fix the build I set
    LD_RUN_PATH to /usr/local/lib and them ran make again.


    HTH
    Martin
  • Martin Franklin at Aug 28, 2003 at 8:44 am

    On Thursday 28 August 2003 8:42 am, Martin Franklin wrote:
    On Wednesday 27 August 2003 9:12 pm, Rob Andrews wrote:
    I'm on a Red Hat 9 system, which has Python 2.2.2 installed, and I
    installed 2.3 separately into /home/rob/Python-2.3/ (creating the
    symbolic link "py23" to point to my 2.3 installation). Now I'm trying to
    work out the kinks in the process.

    Unable to run Idle using 2.3 the way I've got things set up, I created a
    super simple Tkinter test program that just pops up a Label widget. I
    pasted below an example of how the RH-provided 2.2 runs the script
    without incident, but running the script with 2.3 produces a traceback.
    If someone can help me see the error of my ways, I'll be most
    appreciative.

    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ python -V
    Python 2.2.2
    [Wed Aug 27][03:04 PM] ~/Python-2.3/test $ py23 -V
    Python 2.3
    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ py23 test2.py
    Traceback (most recent call last):
    File "test2.py", line 1, in ?
    from Tkinter import Label
    File "/home/rob/Python-2.3/Lib/lib-tk/Tkinter.py", line 38, in ?
    import _tkinter # If this fails your Python may not be configured for
    Tk ImportError: No module named _tkinter
    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ python test2.py

    -Rob
    (mediocre with Python, incompetent with linux)
    Rob,

    I just finished building python 2.3 on my redhat 9 laptop... the first
    time I did the make it failed (near the end) because it couldn't find the
    Tk/Tcl libs.

    On my system they are in /usr/local/lib (because I built them myself)
    on your's I guess they would be in /usr/lib. So to fix the build I set
    LD_RUN_PATH to /usr/local/lib and them ran make again.


    HTH
    Martin


    OK so just to check what I did I did it again...:

    The error I got when I did make for the first time was:-


    gcc -pthread -shared build/temp.linux-i686-2.3/_tkinter.o
    build/temp.linux-i686-2.3/tkappinit.o -L/usr/X11R6/lib -L/usr/local/lib
    -ltk8.4 -ltcl8.4 -lX11 -o build/lib.linux-i686-2.3/_tkinter.so
    *** WARNING: renaming "_tkinter" since importing it failed: libtk8.4.so:
    cannot open shared object file: No such file or directory


    So it looks like _tkinter got compiled OK but when it was imported (as a test
    I presume) it failed to find the tk library.. so:-


    [mfranklin1 at m-franklin Python-2.3]$ export LD_RUN_PATH=/usr/local/lib

    [mfranklin1 at m-franklin Python-2.3]$ make

    gcc -pthread -shared build/temp.linux-i686-2.3/_tkinter.o
    build/temp.linux-i686-2.3/tkappinit.o -L/usr/X11R6/lib -L/usr/local/lib
    -ltk8.4 -ltcl8.4 -lX11 -o build/lib.linux-i686-2.3/_tkinter.so
    running build_scripts

    This time it continues. without error/warning...


    What is LD_RUN_PATH???


    man ld

    <snip>

    -rpath dir
    Add a directory to the runtime library search path. This is used
    when linking an ELF executable with shared objects. All -rpath
    arguments are concatenated and passed to the runtime linker, which
    uses them to locate shared objects at runtime. The -rpath option
    is also used when locating shared objects which are needed by
    shared objects explicitly included in the link; see the description
    of the -rpath-link option. If -rpath is not used when linking an
    ELF executable, the contents of the environment variable
    "LD_RUN_PATH" will be used if it is defined.

    The -rpath option may also be used on SunOS. By default, on SunOS,
    the linker will form a runtime search patch out of all the -L
    options it is given. If a -rpath option is used, the runtime
    search path will be formed exclusively using the -rpath options,
    ignoring the -L options. This can be useful when using gcc, which
    adds many -L options which may be on NFS mounted filesystems.

    For compatibility with other ELF linkers, if the -R option is fol-
    lowed by a directory name, rather than a file name, it is treated


    Cheers
    Martin
  • Martin Franklin at Sep 1, 2003 at 8:34 am

    On Wednesday 27 August 2003 9:12 pm, Rob Andrews wrote:
    I'm on a Red Hat 9 system, which has Python 2.2.2 installed, and I
    installed 2.3 separately into /home/rob/Python-2.3/ (creating the symbolic
    link "py23" to point to my 2.3 installation). Now I'm trying to work out
    the kinks in the process.

    Unable to run Idle using 2.3 the way I've got things set up, I created a
    super simple Tkinter test program that just pops up a Label widget. I
    pasted below an example of how the RH-provided 2.2 runs the script without
    incident, but running the script with 2.3 produces a traceback. If someone
    can help me see the error of my ways, I'll be most appreciative.

    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ python -V
    Python 2.2.2
    [Wed Aug 27][03:04 PM] ~/Python-2.3/test $ py23 -V
    Python 2.3
    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ py23 test2.py
    Traceback (most recent call last):
    File "test2.py", line 1, in ?
    from Tkinter import Label
    File "/home/rob/Python-2.3/Lib/lib-tk/Tkinter.py", line 38, in ?
    import _tkinter # If this fails your Python may not be configured for
    Tk ImportError: No module named _tkinter
    [Wed Aug 27][03:01 PM] ~/Python-2.3/test $ python test2.py

    -Rob
    (mediocre with Python, incompetent with linux)


    Rob,

    I had another look and I think I see your problem... basically I removed the
    /usr/local build of Tcl/Tk so that python 2.3 would 'find' the redhat 9 build
    of Tcl/Tk....

    so I ran configure then make and right at the end of the make:-

    building '_tkinter' extension
    gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC
    -fno-strict-aliasing -DWITH_APPINIT=1 -I/usr/X11R6/include -I.
    -I/usr/python/Python23/TEST111/Python-2.3/./Include
    -I/usr/python/Python23/TEST111/Python-2.3/Include
    -I/usr/python/Python23/TEST111/Python-2.3 -c
    /usr/python/Python23/TEST111/Python-2.3/Modules/_tkinter.c -o
    build/temp.linux-i686-2.3/_tkinter.o
    /usr/python/Python23/TEST111/Python-2.3/Modules/_tkinter.c:96:2: #error
    "unsupported Tcl configuration"
    /usr/python/Python23/TEST111/Python-2.3/Modules/_tkinter.c: In function
    `AsObj':
    /usr/python/Python23/TEST111/Python-2.3/Modules/_tkinter.c:947: warning:
    passing arg 1 of `Tcl_NewUnicodeObj' from incompatible pointer type
    /usr/python/Python23/TEST111/Python-2.3/Modules/_tkinter.c: In function
    `FromObj':
    /usr/python/Python23/TEST111/Python-2.3/Modules/_tkinter.c:1073: warning:
    passing arg 1 of `PyUnicodeUCS2_FromUnicode' from incompatible pointer type




    So it looks like the Tcl/Tk version that comes with RedHat 9 (it apears to be
    Tk 8.3.5 accordfing to the tk.h file in /usr/include) is not compatible with
    the Tkinter in Python 2.3. This means _tkinter.so is not built and Tkinter
    will not work!

    On way round this little problem would be to build your own Tcl/Tk
    (thats what I did) Not only will you get a working Python 2.3 but you get the
    new options in Tk 8.4 too all for an extra couple of downloads and about 30
    mins of 'work'.


    Cheers
    Martin
  • Anthony Baxter at Sep 1, 2003 at 8:44 am

    Martin Franklin wrote
    On way round this little problem would be to build your own Tcl/Tk
    (thats what I did) Not only will you get a working Python 2.3 but you get the
    new options in Tk 8.4 too all for an extra couple of downloads and about 30
    mins of 'work'.
    Alternatively, use the RPMs I built from
    http://www.interlink.com.au/anthony/tech/rh9-tcltk/

    These replace the RH9 Tcl/Tk RPMs with ones that are built from the
    vanilla Tcl/Tk sources; the Redhat breakage is removed. They can just
    be installed with rpm -U tcl*.rpm tk*.rpm
  • Martin Franklin at Sep 1, 2003 at 8:53 am

    On Monday 01 September 2003 9:44 am, Anthony Baxter wrote:
    Martin Franklin wrote
    On way round this little problem would be to build your own Tcl/Tk
    (thats what I did) Not only will you get a working Python 2.3 but you
    get the new options in Tk 8.4 too all for an extra couple of downloads
    and about 30 mins of 'work'.
    Alternatively, use the RPMs I built from
    http://www.interlink.com.au/anthony/tech/rh9-tcltk/

    These replace the RH9 Tcl/Tk RPMs with ones that are built from the
    vanilla Tcl/Tk sources; the Redhat breakage is removed. They can just
    be installed with rpm -U tcl*.rpm tk*.rpm

    From a brief look at the beta of Redhat 10 that's available, they
    appear to have fixed tcl/tk to work properly again (well, at least
    tcl/tk applications no longer consume tens of megabytes per day).
    Thanks... or I could just read the README!!! and I quote...

    Red Hat Linux: Red Hat 9 built Python2.2 in UCS-4 mode and hacked
    Tcl to support it. To compile Python2.3 with Tkinter, you will
    need to pass --enable-unicode=ucs4 flag to ./configure.

    Which I did and now _tkinter.so is building of the box
    so in answer to OP read the README;-)


    Cheers
    Martin
  • Anthony Baxter at Sep 2, 2003 at 4:51 am

    Martin Franklin wrote
    Red Hat Linux: Red Hat 9 built Python2.2 in UCS-4 mode and hacked
    Tcl to support it. To compile Python2.3 with Tkinter, you will
    need to pass --enable-unicode=ucs4 flag to ./configure.

    Which I did and now _tkinter.so is building of the box
    so in answer to OP read the README;-)
    Note that this will "work", but the resulting tk applications will leak
    memory like a sieve.

    --
    Anthony Baxter <anthony at interlink.com.au>
    It's never too late to have a happy childhood.
  • Martin Franklin at Sep 2, 2003 at 9:41 am

    On Tuesday 02 September 2003 5:51 am, Anthony Baxter wrote:
    Martin Franklin wrote
    Red Hat Linux: Red Hat 9 built Python2.2 in UCS-4 mode and hacked
    Tcl to support it. To compile Python2.3 with Tkinter, you will
    need to pass --enable-unicode=ucs4 flag to ./configure.

    Which I did and now _tkinter.so is building of the box
    so in answer to OP read the README;-)
    Note that this will "work", but the resulting tk applications will leak
    memory like a sieve.
    Thanks Anthony, I looked at your site a few minutes after sending my reply..
    Indeed if the OP wants to use tk 8.3 then he should use your RPM's

    I was kind of pushing him into updrading Tk at the same time as Python...


    Cheers,
    Martin

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedAug 27, '03 at 8:12p
activeSep 2, '03 at 9:41a
posts8
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase