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
pyenv install doesn't work with homebrew installed tcl-tk #1375
Comments
For reference these people seem to have this issue as well: This seems like its the same issue as: #1125 |
In my case, in the verbose log of pyenv I get the following error when trying to build tkinter.
Interesting thing is: it works without problem with python 3.5.7, but not with 2.7.16. In fact, in both cases I uninstalled the corresponding python and reinstalled it after |
Ok, a comment on my previous comment. I tried to |
Ok, the problem was actually quite clear from my error log. pyenv looks for tk inside the macos sdk, while it should look into the brew installation, if existent, pretty much like it works with zlib. |
@sartorg I think I had tried that and it didn't work for me. I dont really want to try it again since I ended up editing my python-build file to just have the tcl-tk stuff hard coded. |
@grahamannett Well, if it is just out of curiosity, you can |
I am also seeing this. |
When installing python 3.7.4 using pyenv, why doesn't pyenv use tcl-tk from homebrew like it does for openssl and readline? There should be a way to force pyenv to check for a brew installation of tcl-tk and if it exists then use it. |
I just ran this and I get I'm going to try your suggested CFLAGS and see if that works on my 10.14.6 system. |
@sartorg I tried installing like this (using install 3.7.4) and I still get My log file of the install of 3.7.4 shows the brew installation of tcl-tk is being pulled in. This is becoming maddening! |
Finally! After all of this, I got it to install! Whew! Here's what I did so it may help others: PyEnv Python installation steps to get the latest tcl/tk version on Mac OS 10.14.6 (Mojave) UPDATED for Mac OS Big Sur on Apple Silicon
NOTE: As of this update Homebrew will install the Arm version of pyenv in /opt/homebrew/pyenv.
NOTE: As of this update Homebrew will installs the Arm version of tcl-tk in /opt/homebrew/tcl-tk.
or: /usr/local/Cellar/pyenv/1.2.13/plugins/python-build/bin/python-build **NOTE: For the Arm version you will need to edit /opt/homebrew/Cellar/pyenv/1.2.22/plugins/python-build/bin/python-build ** Once you have the script file open, search for: NOTE: For the Arm build it will have to read
NOTE: For Arm version
If you don't get any errors when running the above test, your installation should work Credits: |
Document fix for Mac users who use pyenv Python installation, to get the latest tcl/tk version working on Mac OS 10.14.6 (Mojave).
Document fix for Mac users who use pyenv Python installation, to get the latest tcl/tk version working on Mac OS 10.14.6 (Mojave).
this should be fixed with #1397. when installing I was using/testing with |
Finally succeed with this method!!!System infomacOS Catalina 10.15.1, tcl-tk 8.6.9, pyenv 1.2.15, and python 3.7.5. Some Notes for your reference:
|
If people are still seeing this and having issues, theres a better PR made that will automatically check for tcl-tk homebrew installed #1409 I don't know what the similar way to do this for linux related installs would be but hopefully it's merged at some point? If someone can explain how to create and test this issue in a linux distro, I would be happy to look into. Also if someone has an idea for how to test this (as the only way I have been able to reliably tell is something along the lines of |
@grahamannett works for me, thx! |
@grahamannett, thanks much for your post. I spent quite a bit of time, failing and failing again, and then I finally succeeded. For others who are novice like me, I am listing the steps I took to successfully install tcl-tk and IDLE to work in MacOS Catalina (10.15.3). It's mostly yours, with a few additional in between.:
Output: tcl-tk 8.6.10 is already installed and up-to-date Output after If you need to have tcl-tk first in your PATH run: For compilers to find tcl-tk you may need to set: For pkg-config to find tcl-tk you may need to set:
Ran $
|
I made all the modifications in the last comment, thank you @sri0sharma ! but I'm still getting a version mismatch.. any tips? 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.
Traceback (most recent call last):
File "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/tkinter/__main__.py", line 7, in <module>
main()
File "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/tkinter/__init__.py", line 4552, in _test
root = Tk()
File "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/tkinter/__init__.py", line 2263, in __init__
self._loadtk()
File "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/tkinter/__init__.py", line 2279, in _loadtk
raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"
RuntimeError: tk.h version (8.6) doesn't match libtk.a version (8.5) |
Hi @ivanoats, I am not an expert. I got my python and tck running by trial and error. I campared your files "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/runpy.py", "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/tkinter/main.py", and "/Users/ivan/.pyenv/versions/3.8.1/lib/python3.8/tkinter/init.py"
I don't exactly recall, but I had to try a few times, before my steps worked. In fact, I did uninstall my brew and pyenv and did clean install again for these steps to work. Good luck! |
This issue was closed, but how was it resolved? |
see* @ivanoats* comment on this gist at
https://gist.github.com/iexa/2ac761bfd96ab78988b76c030d54a5b8:
------------------------------
"FWIW, I tried both the pyenv and the homebrew replacement and only the
homebrew replacement really worked. Thank you !"
Basically, you need to do a clean pyenv and homebrew install in the order
listed under @sri0sharma at #1375.
Good luck!
…On Fri, Apr 24, 2020 at 5:36 AM Nat Ersoz ***@***.***> wrote:
This issue was closed, but how was it resolved?
I see lots of disparate things that people have done - but which one works?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1375 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHQZTXTCQKU7UW44WYRKXLLRODJWRANCNFSM4IE6L7XA>
.
|
Similar to others, this link (https://stackoverflow.com/questions/60469202/unable-to-install-tkinter-with-pyenv-pythons-on-macos/60469203#60469203) fixed everything, and I did not have to manually deal with the build files etc. It even has a comment about the error that gets thrown for 8.5 versus 8.6. Worked perfectly for me, hope it helps you out too. |
Thanks much, Jenna.
In fact, I figured it out a few months ago (sometime in Feb), and posted my
detailed solutions at two places on github (see:
#1375 (comment)). Many
people have already used them as I keep getting their emails in
acknowledgement. Somehow I forgot that I had posted my questions first at
stackflow.com, as I wanted to post my solution there, too, but could not
remember at that time.
Sri
…On Thu, Jun 4, 2020 at 10:22 PM Jenna Pearson ***@***.***> wrote:
Similar to others, this link (
https://stackoverflow.com/questions/60469202/unable-to-install-tkinter-with-pyenv-pythons-on-macos/60469203#60469203)
fixed everything, and I did not have to manually deal with the build files
etc. It even has a comment about the error that gets thrown for 8.5 versus
8.6. Worked perfectly for me, hope it helps you out too.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1375 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHQZTXWS7MUNXSAE5Y5M5SLRU7GOFANCNFSM4IE6L7XA>
.
|
No problem :) I was thankful for your thread!
Best,
Jenna Lynn Pearson
Ph.D. Candidate
Department of Earth, Environmental, and Planetary Sciences
Brown University, Providence, RI 02912 USA
https://jlpearso.github.io/
…On Thu, 4 Jun 2020 at 12:35, Ryan ***@***.***> wrote:
Thanks much, Jenna.
In fact, I figured it out a few months ago (sometime in Feb), and posted my
detailed solutions at two places on github (see:
#1375 (comment)). Many
people have already used them as I keep getting their emails in
acknowledgement. Somehow I forgot that I had posted my questions first at
stackflow.com, as I wanted to post my solution there, too, but could not
remember at that time.
Sri
On Thu, Jun 4, 2020 at 10:22 PM Jenna Pearson ***@***.***>
wrote:
> Similar to others, this link (
>
https://stackoverflow.com/questions/60469202/unable-to-install-tkinter-with-pyenv-pythons-on-macos/60469203#60469203
)
> fixed everything, and I did not have to manually deal with the build
files
> etc. It even has a comment about the error that gets thrown for 8.5
versus
> 8.6. Worked perfectly for me, hope it helps you out too.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1375 (comment)>, or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AHQZTXWS7MUNXSAE5Y5M5SLRU7GOFANCNFSM4IE6L7XA
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1375 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHW6P3DNEVJHLQO4JCKSFIDRU7ZRTANCNFSM4IE6L7XA>
.
|
This method worked for me. |
This worked for me with a few small adjustments. Instead of ~/.zshrc I had to put the export statements into ~/.profile because I'm using bash. The version of pyenv has changed so the path to the pyenv python-build file changed and 1.2.13 needed to be replaced with my version. Lastly I uninstalled the previous version I had installed with This solution also works with pipenv which uses pyenv to install python. |
Thanks, Ralph. Good to know it worked for you. Thank you for updating it.
…On Thu, Jul 2, 2020 at 10:21 PM Ralph Ritoch ***@***.***> wrote:
***@***.*** <https://github.com/grahamannett>*, thanks much for your
post. I spent quite a bit of time, failing and failing again, and then I
finally succeeded. For others who are novice like me, I am listing the
steps I took to successfully install tcl-tk and IDLE to work in MacOS
Catalina (10.15.3). It's mostly yours, with a few additional in between.:
1. ran $`brew install pyenv`
Output: Warning: pyenv 1.2.16 is already installed and up-to-date
To reinstall 1.2.16, ran `brew reinstall pyenv`
/usr/local/Cellar/pyenv/1.2.16: 671 files, 2.5MB
2. ran $`brew install tcl-tk`
Output: tcl-tk 8.6.10 is already installed and up-to-date
To reinstall 8.6.10, run brew reinstall tcl-tk
Output after brew reinstall tcl-tk:
tcl-tk is keg-only, which means it was not symlinked into /usr/local,
because tk installs some X11 headers and macOS provides an (older) Tcl/Tk.
If you need to have tcl-tk first in your PATH run:
echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> ~/.zshrc
(I added it to ~/.zshrc as the first line)
For compilers to find tcl-tk you may need to set:
export LDFLAGS="-L/usr/local/opt/tcl-tk/lib"
export CPPFLAGS="-I/usr/local/opt/tcl-tk/include"
(I added these two to ~/.zshrc, too, after adding the above)
For pkg-config to find tcl-tk you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig"
(I added this to ~/.zshrc, too, after adding the above)
1. To get tcl-tk 8.6 to work with the pyenv install of python, I found:
/usr/local/Cellar/pyenv/1.2.13/plugins/python-build/bin/python-build
and replaced the following:
$CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" || return 1
with:
$CONFIGURE_OPTS --with-tcltk-includes='-I/usr/local/opt/tcl-tk/include' --with-tcltk-libs='-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6' ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" || return 1
2. ran $`pyenv install 3.8.1`
Installed Python-3.8.1 to /Users/ryan/.pyenv/versions/3.8.1
3. ran $`pyenv global 3.8.1`
Refreshed the current terminal and checked by running
4. $`pyenv version`
output: 3.8.1 (set by /Users/ryan/.pyenv/version)
Ran $python -V
output: Python 3.8.1
1. ran $`pip install --upgrade` pip (since I had previously already installed pip using $`pip install`)
output: Successfully installed pip-20.0.2
2. Tested my tcl-tk installation with $`python -m tkinter -c 'tkinter._test()'`
Output: Tk window popped up. Hit ‘Quit’ to back to Terminal.
3. Ran $ `idle`
Output: Python 3.8.1 Shell window popped up.
This worked for me with a few small adjustments.
Instead of ~/.zshrc I had to put the export statements into ~/.profile
because I'm using bash. The version of pyenv has changed so the path to the
pyenv python-build file changed and 1.2.13 needed to be replaced with my
version. Lastly I uninstalled the previous version I had installed withpyenv
uninstall 3.5.8 and then re-installed.
This solution also works with pipenv which uses pyenv to install python.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1375 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHQZTXVZEP7RAPLC4TOGD23RZS3JLANCNFSM4IE6L7XA>
.
|
The easier way to do this w/o editing homebrew files is provided by the PR described here and the command line to do it is e.g.
|
Building on @elgow's comment, this also worked for me with no editing of pyenv or .zshrc (including --enable-shared or --enable-framework), albeit with a slight adjustment (mainly adding
|
I ran into the same problem and I tried everything I can, but it still can't find where the _tkinter module is |
My nickel into the tkinter on OS X community stash: |
I have the same issue on arch: why isn't tkinter compiled with python? |
Thanks a lot for the solution! For people who are following this tutorial, be sure to change to your current pyenv version in the line
if it is your path for the python-build script. |
Hello,
My name is Aarushi Sharma. You may have been trying to contact my father,
Srinarayan Sharma. Sadly, he died of COVID-19 pneumonia on April 24th, 2021
and will no longer be able to respond to any emails or complete any
requests.
I hope this email hasn’t inconvenienced you too much. I’m really sorry for
any complications this may have caused.
Yours,
Aarushi Sharma
…On Thursday, May 20, 2021, Clément Verrier ***@***.***> wrote:
Thanks a lot for the solution! For people who are following this tutorial,
be sure to change the line
/usr/local/Cellar/pyenv/1.2.13/plugins/python-build/bin/python-build
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1375 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHQZTXSCG3CHFT2E7YSRFEDTOTBD3ANCNFSM4IE6L7XA>
.
|
I've faced the same situation and I finally figured out that I didn't install After I installed the plugin |
When installing any version of python with pyenv, I can't get tkinter to work. Python install fine but I believe that the files related to tcl-tk are causing issues and python-build either needs to skip the files related in
For instance with python installed from pyenv in any manner of way:
etc.
and then trying to use tkinter from that python:
Looking at the log does it matter that the tcl-tk stuff that is included with macosx is included before the brew ones?
For why I think it has to do with pyenv/python-build, the brew installed python 3 works with tkinter
/usr/local/bin/python3 -c 'import tkinter; tkinter._test()'
Too many issues will kill our team's development velocity, drastically.
Make sure you have checked all steps below.
Prerequisite
pyenv
and the defaultpython-build
plugin only. Please refrain from reporting issues of other plugins here.Description
PYENV_DEBUG=1
, e.g.env PYENV_DEBUG=1 pyenv install -v 3.6.4
https://gist.github.com/grahamannett/88a8c06aa864cc38a814046c364537e6
The text was updated successfully, but these errors were encountered: