Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11.0 install doesn’t recognize homebrew Tcl/Tk due to --with-tcltk-libs, --with-tcltk-includes switches being removed from 3.11 #2499

Closed
6 tasks done
kjoonlee opened this issue Oct 26, 2022 · 2 comments · Fixed by #2501

Comments

@kjoonlee
Copy link

kjoonlee commented Oct 26, 2022

Description

I have homebrew python-tk@3.9, python-tk@3.10, and tcl-tk installed.

Python 3.11.0 does not recognize these options:

configure: WARNING: unrecognized options: --with-tcltk-libs, --with-tcltk-includes

I think it’s an intended change, judging from python/cpython#95957 (comment)

Anyway, so Homebrew tkinter is actually recognized at first:

++(/Users/kjoonlee/.pyenv/plugins/python-build/bin/python-build:1558): use_homebrew_tcltk(): can_use_homebrew

But because the switches have been removed, it is reported as missing:

checking for stdlib extension module _tkinter... missing

So it is not built:

The necessary bits to build these optional modules were not found:
_tkinter                                                       
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Apologies if anything doesn’t make sense or if it’s unclear. Is there anything I’m doing wrong about the installation, please? Entering a bug just in case.

@kjoonlee
Copy link
Author

kjoonlee commented Oct 26, 2022

Workaround: manually setting the flags before running pyenv worked for me:

On Intel:

export TCLTK_LIBS="-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6"
export TCLTK_CFLAGS="-I/usr/local/opt/tcl-tk/include"
pyenv install 3.11.0

On Apple Silicon:

export TCLTK_LIBS="-L/opt/homebrew/opt/tcl-tk/lib -ltcl8.6 -ltk8.6"
export TCLTK_CFLAGS="-I/opt/homebrew/opt/tcl-tk/include"
pyenv install 3.11.0

trace.log and https://github.com/python/cpython/blob/main/Doc/whatsnew/3.11.rst#build-changes gave me the info for this.

@p-i-
Copy link

p-i- commented Oct 27, 2022

How are you even getting pyenv install 3.11 to run?

It doesn't seem to be available:

> pyenv install 3.11
python-build: definition not found: 3.11

The following versions contain `3.11' in the name:
  3.11.0rc2
  3.11-dev
  miniconda3-4.3.11

See all available versions with `pyenv install --list'.

If the version you need is missing, try upgrading pyenv:

  brew update && brew upgrade pyenv

Note: I've run brew update && brew upgrade pyenv and still no luck.

Where can I find out the timeline for pyenv supporting 3.11?

EDIT: homebrew pyenv isn't latest. So brew uninstall pyenv ; rm -rf ~/.pyenv ; curl https://pyenv.run | bash ... now pyenv install 3.11.0 works. Then pyenv global 3.11.0 and I think I'm setup now. i.e. I'm installing it directly from pyenv github master branch.

EDIT: This still wasn't a complete solution for me. I've documented my final solution here: https://stackoverflow.com/questions/74237882/pip-install-modulenotfound-error-in-venv-after-installing-upgrading-to-pyth

I really wish some body in the Python ecosystem would take on the challenge of maintaining a wiki that allows the community to document, structure and explain the various "winning design patterns" for setting up Python tooling. It's a high bar for a newcomer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants