Python installation questions

Discussion in 'Mac Programming' started by macmesser, Sep 16, 2016.

Tags:
  1. macmesser macrumors 6502a

    Joined:
    Aug 13, 2012
    Location:
    Long Island, NY USA
    #1
    I just bought the new programming course from The Teaching Company and am setting up to play with Python. It looks to be a painless way to learn Python and review familiar programming concepts. Fun stuff for me but, with non-existant to minimal unix skills, I need some help getting started.

    I am running 10.11.6 on CMP 5,1 and just installed Python 3.5.2 64 bit (python-3.5.3-macos10.6.pkg). Per Python.org recommendation I also installed Tcl/Tk from ActiveState (ActiveTcl8.6.4.1.299124-macosx10.5-i386-x86_64-threaded.dmg). The information I was going on is here at:

    https://www.python.org/download/mac/tcltk/

    I first installed Python 3.5.2 and then the Tcl/Tk package, but after re-reading the above linked page I am wondering if the installation order is critical and should have been reversed. The excerpt below (specifically the parts I highlighted in red) is what gave me pause. My concern is that the Python installer could have linked Python to the pre-existing Tcl/Tk (I think Apple 8.5.9) rather than the recommended version from ActiveState. Do the Apple native and the ActiveState Tcl/Tk frameworks now coexist on my system in different locations, and is the behavior of the dynamic linker determined only at run time, or does it point to the Tcl/Tk framework to be used when Python is installed?

    ------------------------python.org excerpt begins---------------------

    How Python Chooses Which Tk Library To Use
    Note

    While Tcl and Tk are separate frameworks and libraries, they are closely related and are normally installed or updated simultaneously. You should not attempt to mix-and-match Tcl and Tk versions. References to a specific version of Tk assume the corresponding version of Tcl is installed as well.

    The Python for Mac OS X installers downloaded from this website dynamically link at runtime to Tcl/Tk Mac OS X frameworks. The Tcl/Tk major version is determined when the installer is created and cannot be overridden. The Python 64-bit/32-bit Mac OS X installers for Python 3.5.x, 3.4.x, 3.3.x, 3.2.x, and 2.7.x dynamically link to Tcl/Tk 8.5 frameworks. 32-bit-only Python installers for Mac OS X dynamically link to Tcl/Tk 8.4 frameworks.

    In either case, the dynamically linking occurs when tkinter (Python 3) or Tkinter (Python 2) is first imported (specifically, the internal _tkinter C extension module). By default, the Mac OS X dynamic linker looks first in /Library/Frameworks for Tcl and Tk frameworks with the proper major version. This is the standard location for third-party or built from source frameworks, including the ActiveTcl releases. If frameworks of the proper major version are not found there, the dynamic linker looks for the same version in /System/Library/Frameworks, the location for Apple-supplied frameworks shipped with Mac OS X. (Note, you should normally not modify or delete files in /System/Library.)

    ------------------------python.org excerpt ends-----------------------
    --- Post Merged, Sep 16, 2016 ---
    Seems like my concerns are real, so I now need get Python to use the recommended version. I just tested the installation by opening IDLE and, although able to print a line, it gave the following message immediately:

    ---------IDLE message begins----------
    Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25)
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "copyright", "credits" or "license()" for more information.
    >>> WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
    Visit http://www.python.org/download/mac/tcltk/ for current information.
    print ("oi, veh!")
    oi, veh!
    >>>
    ---------IDLE message ends-----------

    Interestingly, the Tcl/Tk (8.5.9) that was the subject of the warning IS, as far as I can tell, the Apple-supplied standard OS equipment. Could the problem be with the Python installation? Thanks in advance for any help.
     
  2. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #2
    You need Tcl/Tk 8.5, unfortunately. Python for Mac won't link against 8.6.
     
  3. macmesser, Sep 19, 2016
    Last edited: Sep 19, 2016

    macmesser thread starter macrumors 6502a

    Joined:
    Aug 13, 2012
    Location:
    Long Island, NY USA
    #3
    Thanks or reply. Hmm. It seemed to be the recommended package at Python.org. Didn't realize I was that confused. So apparently what happened is that Python linked with the version it could link with, which was the Apple-installed 8.5.9. I think it was ActiveState also (?) but may be wrong on that. This raises the question as to why I got the "may be unstable" warning message after linking with 8.5.9. No place higher to go in the 8.5.x's. Doesn't seem as if I should need an older version than the OS standard for Python 3.5.2.
    --- Post Merged, Sep 19, 2016 ---
    BTW, there is more on this issue on the Apple support forum, here: https://discussions.apple.com/thread/7670778
    --- Post Merged, Sep 19, 2016 ---
    What version 8.5.x Tcl/Tk should I install and will it coexist as an independent framework with any other versions installed? There are two already on my system.
     
  4. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #4
    Did the ActiveState site show both 8.6 and 8.5.18.1, with 8.6 on top? If so you want the bottom one.
     
  5. macmesser thread starter macrumors 6502a

    Joined:
    Aug 13, 2012
    Location:
    Long Island, NY USA
    #5
    Thanks for reply. I'll check it out. Should installing 8.5.18.1 just fix things or will I need to uninstall and reinstall Tcl/Tk and/or Python? Does Tcl/Tk need to be installed before Python?
     
  6. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
  7. macmesser thread starter macrumors 6502a

    Joined:
    Aug 13, 2012
    Location:
    Long Island, NY USA
    #7
    Thanks again. Not to belabor this, but I still have a few basic questions which will help me understand what's at play.

    Will installing Tcl/Tk 8.5.18.1 fix it because the Python in my 3.5.2 installer from python.org has been compiled to link it? (I intend to just run the Tcl/Tk package installer over what I have now, which is OS standard Python/Tcl/Tk software plus Python 3.5.2 and Tcl/Tk 8.6.4.1 - is this OK?)

    Will running different version installers for Python and Tcl/Tk in general produce independent version installations or is there a possibility of a new one stepping on the toes of a previous installation, resulting in one or both being broken?
     
  8. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #8
    First question about linking: Yes. Python 3.x for Mac only links against Tcl/Tk 8.5, NOT 8.6.

    Second and third questions: I've never tested this scenario before. I believe they will all function independently, since they install themselves to different places on disk. So you should be good to go.
     
  9. macmesser thread starter macrumors 6502a

    Joined:
    Aug 13, 2012
    Location:
    Long Island, NY USA
    #9
    Success. I installed the 8.5 option available (listed after 8.6) at activestate.com. The current download file is ActiveTcl8.5.18.0.298892-macosx10.5-i386-x86_64-threaded.dmg so seems it may not be quite 8.5.18.1 , unless there is a small inconsistency in the name of the dmg file. The important thing is that it works without throwing an alert in idle. Thanks for bearing with me.
     
  10. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #10
    You've got the right one now. I may have misspoke about Tcl 8.5.18 exact version.
     

Share This Page