7

I think the short version of this question is: How do I get a virtualenv running Python 3.5 to point to the correct version of ActiveTcl on a Mac?


Here's the longer version:

I'm trying to run this Korg Electribe sample editor project on a Mac. The author has only tested it on Windows, and based on the screenshots, it appears to work. I've been able to run the basic python script fine, but as I mention in an issue that I've opened, the full window turns black after loading a file.

After doing some research, I've found that there is a known issue with Aqua Cocoa Tk, and python.org has provided some instrunctions about how to fix tkinter for Mac OS 10.9 and up. I've attempted installing both of the suggested ActiveTcl (8.5.18.0) as well as the newer 8.6.x.x version without success.

I'm pretty sure this is a different issue than Tkinter not working mac osx el capitan, since the script does run, and the window is drawn properly on launch. It's only after I've attempted to load a .all file (there's a sample file in the Github issue) that the screen goes black.

After some more research, I've found this question that seems related, but is specific to Windows: TKinter in a Virtualenv

I'm under the impression that if I can figure out what to set TCL_LIBRARY to, that I'll be able to make some head-way, but I can't seem to find that information for the packages listed on python.org.

Somewhat related, it would also seem to be helpful if I could figure out which version of Tcl/Tk that tkinter is pointing to from within Python, so if anyone could help with that as well, I'd greatly appreciate it.

Thanks!

Community
  • 1
  • 1
Kevin
  • 1,132
  • 2
  • 13
  • 24
  • Did you ever figure this out? – Alex Aug 05 '17 at 20:41
  • There have been some updates and comments to the Github issue linked above, but I haven't followed up to see if the issue is actually fixed, or what the cause was. – Kevin Aug 07 '17 at 08:58

1 Answers1

1

I succeeded in using tkinter in a python3 virtualenv on OSX 10.13 by :

  • installing the official OSX Python 3 from https://www.python.org/
  • installing activeTcl from https://www.activestate.com/activetcl
  • creating a new virtualenv

    mkvirtualenv myenv --python=python3
    
  • locating the tkinter location in the Python3 directory. For me it was here :

    /usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter
    
  • creating a symbolic link in the virtualenv library pointing to the tkinter location

    cd ~/.virtualenvs/myenv/lib/python3.6
    ln -s /usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter tkinter
    
olitocin
  • 41
  • 5
  • YES! you finally ended my aimless wandering about the internet. This was an issue with a [virtualfish](https://github.com/adambrenecki/virtualfish) environment on ubuntu 18.04. My magic incantation turned out to be `ln -s /usr/lib/python3.6/lib-dynload/_tkinter.cpython-36m-x86_64-linux-gnu.so ~/.virtualenvs/science/lib/python3.6/lib-dynload/_tkinter.cpython-36m-x86_64-linux-gnu.so`. `science` is the virtualenv name; modify for your purposes as needed. – waterproof Apr 11 '19 at 20:07