Installing Python 3.5.2 and ActiveState Tcl/Tk

I installed Python 3.5.2 package from python.org and per their recommendation went to activestate.com and downloaded and installed recommended Tcl/Tk package. When IDLE was opened it gave a message that Tcl/Tk was unstable and it appeared that the version was the one that came with the OS and not the one from ActiveState.com. I have more info on what I did at Macrumors.com here: Python installation questions.


Could the problem be that I installed Python 3.5.2 before I installed the ActiveState Tcl/Tk? I found some information about when the dynamic linker chooses the Tcl/Tk framework (at time of import) to link but didn't understand the implications. I'm wondering if installing Python 3.5.2 before I installed the recommended Tcl/Tk framework caused the dynamic linker to link the Apple Tcl/Tk instead. I might need to tell the linker to use the new framework. Any insights appreciated.

Posted on Sep 17, 2016 2:42 PM

Reply
8 replies

Sep 18, 2016 1:06 AM in response to Thomas Camilleri

When you run idle, by default, it is /usr/bin/idle which is installed by OS X (El Capitan) as the Python 2.7.10 distribution. It was compiled to look for the ActiveState Tcl v8.5.9 that Apple continues to ship.


When you installed Python 3.5.2, and I hope you did not install it over the existing OS X Python, it was a precompiled binary distribution that may not have been compiled to know about anything more than the available Tcl/Tk Frameworks that were part of OS X at the time. Even if you ran idle3 from within that Python 3.5.2 distribution, you may see no change in Tcl/Tk support.


When one installs Python from a package manager such as Homebrew, or alternatively, builds the source code themselves, there are build parameters (e.g. --with-tcl-tk) that tell the Python 3.5.2 source code to look for the Tcl/Tk Frameworks, and to use the ActiveState 8.6.4+ libraries if they are found. As idle3 is compiled at that time too, it knows to use the latest available Tcl/Tk Frameworks. This is the case with my idle3.


If you plan to build your own Python 3.5.2, you will need the latest command line tools for (OS X El Capitan), and I would encourage you to put the distribution into the /usr/local tree. I patched, and still use pythonbrew for multiple Python distribution juggling, as I have v2.7.12, and 3.5.2 installed. Both of these Python distributions let me build against ActiveState Tcl/Tk libraries.

Sep 18, 2016 1:25 AM in response to VikingOSX

Thanks for reply. I did run idle from within the Python 3.5.2 installation so I guess the binary does not know about the newer Tcl/Tk. I thought Python would look for it by searching in successive locations before defaulting if none found. Python.org specified the Python and Tcl/Tk installers so I expected them to work together.


Unfortunately I did install 3.5.2 over the existing OS X Python expecting to get an independent installation. Did I muck things up? How can I fix it?

Sep 18, 2016 5:21 AM in response to Thomas Camilleri

I just sat down and looked inside the Python 3.5.2 package installer. It deliberately does not step on the default OS X Python installation, when taking the installer defaults. Python 3.5.2 installs its Python.framework in /Library/Frameworks, and command-line binary tools into the /usr/local tree. Therefore, you are ok — providing you did not alter the default install destination.


It is unclear if the Python 3.5.2 installation provides you with a script to switch between Python 3.5.2 and OS X versions of Python. If you reference Python as /usr/local/bin/python, and idle as /usr/local/bin/idle, you should get the 3.5.2 versions of these applications. You may need to set/unset the $PYTHONPATH environment variable to the null string to access the default System Python, or the following to access Python 3.5.2:


/Library/Frameworks/Python.framework/Version/3.5/lib

Sep 18, 2016 9:55 AM in response to VikingOSX

Thanks for help; this is good news! Fortunately I let it use default destination. I guess I must be starting the new installation of Python as I ran idle from a new Python 3.5 folder which had been installed under Applications. Idle gave me the message that Tcl/Tk might be unstable. I will check the Python version and $PYTHONPATH environment variable to see current value and also try setting it to null and trying to run the Mac OS installation. Since the alert I got concerns Tcl/Tk, maybe the problem is with the Tcl/Tk version Python is linked to, which appears to be the native Mac OS installed framework. Is there a way to change this to point to the latest ActiveState framework (and learn where it's installed)?

Sep 19, 2016 5:32 AM in response to VikingOSX

I was told (on the Macrumors.com thread linked to in a previous post) that Python will not link against Tcl/Tk 8.6 and that I need a version 8.5.x. The version giving the warning in idle is 8.5.9 and came with El Capitan. Should I install an earlier version and, if so, how to know which? Will new installations of Tcl/Tk interfere with or overwrite one another? Or will they coexist as options which can be accessed by setting the $PYTHONPATH environment variable?

Sep 19, 2016 7:50 AM in response to Thomas Camilleri

Well, you know what they say about something being true if it is written on the Internet.... 😉


The following idle and idle3 screen captures tell the story:


User uploaded file

User uploaded file


You see version 8.6.4 for idle3, because that was the ActiveState Tcl/Tk Frameworks that were installed when I compiled the Python 3.5.2 source with appropriate flag to tell it to use them.


I have read that if you install the ActiveState Tcl/Tk 8.5.18.0 Frameworks after you install Python 3.5.2, that it won't find them, but if you uninstall Python 3.5.2, and then reinstall it, then idle3 will find that latest ActiveState Tcl/Tk Frameworks. You might give that a try.


Here is some code that automatically works for Python 2.7.10, 2.7.12, and 3.5.2:

User uploaded file

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Installing Python 3.5.2 and ActiveState Tcl/Tk

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.