0

I developed a Tkinter app (with python version 3.10.6) on a mac (BigSur) and wrapped all the app files through py2app for use on others macs. When I run on another mac (Monterey) I get the following error:

_tkinter.TclError: Can't find a usable init.tcl in the following directories:
/usr/local/Cellar/tcl-tk/8.2 12_1/lib/tcl8.6 

I search all over the internet and couldn't find any solution. What should I do to correct this blocking problem ?

update question 01/10/2022

In fact, here is the problem that I was unable to explain the first time: I coded my python application on a 2020 Mac (Silicon processor). At work I have an old Mac from 2013 (Intel processor). When I coded my app on the work Mac, I wrapped all my python files with py2app to make it an .app (the goal being to use the application on other macs). For that I had to update my version of python and install the homebrew package manager.

  • Homebrew is installed in /opt/homebrew for Macs equipped with a Silicon processor
  • Homebrew is installed in /usr/local for Macs with an Intel processor So when I run my version (coded on the 2013 Mac) on my 2020 Mac, I get an error message because it is looking for tcl-tk/8.2 12_1/lib/tcl8.6 in the /usr/ folder local/ and it can't find it since it's in /opt/homebrew. Conversely, if I code on my 2020 mac, wrap with py2app and run the app on my 2013 work computer, I get an error message because it's looking for tcl-tk/8.2 12_1/lib /tcl8.6 in the /opt/homebrew folder.

I don't know how to solve this problem; in any case I tried hard to understand; I am a beginner and if you have an idea of ​​code to add to make this distinction and get the right folder in the right place it would be very useful to me.

  • I have an [answer](https://stackoverflow.com/questions/73056296/tkinter-on-mac-shows-up-as-a-black-screen/73186351#73186351) that might help. I know it's not exactly the same issue as the one in the linked question, but I outline the steps needed to install an updated tkinter package. Hopefully this points you in the right direction. – JRiggles Sep 29 '22 at 12:30
  • @JRiggles Thank you for that answer. The error message says it cannot find a "tcl8.6.12" folder in my app. I followed the procedure, but I am totally new to macOS. I installed homebrew, uninstalled and reinstalled tcl-tk, but I can't figure out where in my computer is that tcl folder. The mistake: Can't find a usable init.tcl in the following directories: /usr/local/Cellar/tcl-tk/8.6.12_1/lib/tcl8.6 What is this "Cellar" address? I don't understand at all what I need to do to fix this error. – walkingtomron Sep 29 '22 at 16:46
  • How are you running your app? If you're using the terminal then you may be running your app with the system version of Python that comes with Mac OS. It's required by the OS, but isn't recommended for development. – JRiggles Sep 29 '22 at 16:51
  • @JRiggles I run the .app created in the dist folder by py2app. – walkingtomron Sep 29 '22 at 16:57
  • I'm afraid I'm not familiar enough with py2app to speak on it, but it might be worth trying to run your .py file from Terminal (e.g., `python myapp.py`) to see if it works there. If it doesn't, you may have other issues with your code. If it *does* work from the Terminal, then the issue is more likely related to py2app – JRiggles Sep 29 '22 at 17:02
  • I still suspect your issue is related to the fact that you're using the Mac OS system Python. You may want to look into installing pyenv and a separate more up-to-date version of Python (i.e., 3.10) – JRiggles Sep 29 '22 at 17:07
  • @JRiggles Thank you for this answer but I am a beginner on mac and I do not understand at all what you are telling me. I installed python version 3.10.6 with brew. Could you be more specific please? "You may want to look into installing pyenv and a separate more up-to-date version of Python (i.e., 3.10)" => what do you mean ? – walkingtomron Sep 29 '22 at 17:28
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/248452/discussion-between-jriggles-and-walkingtomron). – JRiggles Sep 29 '22 at 17:32

0 Answers0