raspberrypi / pico-project-generator

Tool to automatically generate a Pico C SDK Project
BSD 3-Clause "New" or "Revised" License
303 stars 74 forks source link

macOS TK Depreciation #50

Closed tornupnegatives closed 2 years ago

tornupnegatives commented 2 years ago

Running pico_project.py results in a completely black window being displayed, and the following warning is issued:

DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.

I am running macOS 12.2.1 on a MacBook Pro (15-inch, 2019).

create-msugi commented 2 years ago

You need to download Python3 from python.org and install it. Then everything will be fine. I am using macOS 12.2.1 (Monterey) on a MacBook Pro (16-inch, 2019) and a Mac Pro (Late 2013). It seems to be no problem.

lurch commented 2 years ago

You need to download Python3 from python.org and install it. Then everything will be fine.

That's interesting, thanks :+1:

@JamesH65 Maybe it's worth mentioning that in this repo's README.md ?

EDIT: Deleted my comment because apparently it was incorrect.

aallan commented 2 years ago

You need to download Python3 from python.org and install it.

The recommended way to install Python on macOS is via Homebrew, see Section 9.1 in "Getting started with Raspberry Pi Pico".

tornupnegatives commented 2 years ago

I think @create-msugi makes a valid point in that the root of this error is a mismatch between my Python environment (via pyenv-virtualenv from Homebrew) and the system's Tk build. However, anyone who works with Python academically or professionally is bound to have more than one environment. As such, installing via python.org or even straight from Homebrew as @lurch suggested may be undesirable.

Ideally, there would be a way to install Tk/tkinter via pip or Homebrew and put that in the $PATH. I am just not experienced enough with Tk to know how this is done... Other suggestions appreciated.

tornupnegatives commented 2 years ago

UPDATE: I was able to get it working by installing tcl-tk via Homebrew and then re-installing Python via pyenv. Finding a Python version that would build on macOS was a whole different can of worms, but at least the GUI is all good now :).

Closing since it is more of a Python/Tk problem than a RPi problem.