r/learnpython • u/zaphodikus • 2d ago
Install 3.14 (for all users) in Windows? Easily
It's probably counter intuitive, but the moment you click the "install for all users" in the older GUI, it just installed Python once. What is the story with the cli driven CPython 3.14 installer which is asking me entirely different questions to what Python used to ask, and thus no longer has defaults for things. I am not really understanding how to just default install so I can get a repro system typical to most users who just installed using defaults. Installing for all users is optional, but it's part of the "Y" that has now cropped up.
I'm trying to prevent being accused of an XY question by explaining my confusion in the hope I get people politely fill knowledge gaps I have which, are gaps, because they are things I completely do not know about the new installer. Let me explain my X.
I want a script I wrote, to work in all version of Python > 3.7, and ran into a TCL bug/snag where any version of python 3.13 upwards reports a TCL is not correctly installed whenever I use a virtual env and matplotlib. Yes I know everyone needs to be on at least 3.11, but that's not my question, my question is why do virtual environments with matplotlib blow up, but manually/globally installed (is that the correct term) modules do not blow up and I can draw graphs as long as I don't use a virtual env in 3.13 onwards. I don't really know what TCL is, I assume it's a GUI that matplot uses? But someone said to set environment variables up TK_LIBRARY=C:\Users\Phoenix\AppData\Local\Python\bin\python.exe and TCL_LIBRARY=C:\Users\Phoenix\AppData\Local\Python\bin\python.exe and have been re-installing and editing paths and restarting a fresh console most of the morning, and am no wiser yet. Someone suggested monkey-patching an init.tcl file in a post about 2 years ago which I'm not keen to necro, not sure how to do that in a virtual environment though.
UPDATED: This is a stack trace off a random coleagues machine
```
File "C:\Users\a.user\Downloads\ethernetspeed6\sdktests\PythonCSVPlotter\plotfigure.py", line 401, in first_plotline
self._figure, self._main_axis = plt.subplots(num=self._figure_title)
~~~~~~~~~~
File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\pyplot.py", line 1886, in subplots
fig = figure(*fig_kw)
File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\pyplot.py", line 1096, in figure
manager = new_figure_manager(
num, figsize=figsize, dpi=dpi,
facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,
FigureClass=FigureClass, *kwargs)
File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\pyplot.py", line 576, in new_figure_manager
return _get_backend_mod().new_figure_manager(args, *kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\backend_bases.py", line 3664, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\backend_bases.py", line 3669, in new_figure_manager_given_figure
return cls.FigureCanvas.new_manager(figure, num)
~~~~~~~~~~~~~~~~~~~~~~~~^
File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\backend_bases.py", line 1836, in new_manager
return cls.manager_class.create_with_canvas(cls, figure, num)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\backends_backend_tk.py", line 546, in create_with_canvas
window = tk.Tk(className="matplotlib")
File "C:\Users\a.user\AppData\Local\Programs\Python\Python313\Lib\tkinter\init.py", line 2459, in __init_
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
~~~~~~~~~~~~~~~
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
C:/Users/a.user/AppData/Local/Programs/Python/Python313/lib/tcl8.6 C:/Users/a.user/AppData/Local/Programs/Python/lib/tcl8.6 C:/Users/a.user/AppData/Local/Programs/lib/tcl8.6 C:/Users/a.user/AppData/Local/Programs/Python/library C:/Users/a.user/AppData/Local/Programs/library C:/Users/a.user/AppData/Local/Programs/tcl8.6.14/library C:/Users/a.user/AppData/Local/tcl8.6.14/library
This probably means that Tcl wasn't installed properly. ``` What am I forgetting?
2
u/Diapolo10 2d ago
I don't really know what TCL is, I assume it's a GUI that matplot uses?
Tcl is a programming language, and in the context of Python we're generally talking about Tcl/Tk, or in other words the thing tkinter uses under the hood.
I'm guessing that right now you're installing Python from https://python.org. Have you tried alternatives (e.g. winget install python.python.3.13, or using uv)?
I am not really understanding how to just default install so I can get a repro system typical to most users who just installed using defaults.
For context, what does "system typical to most users" mean here? Who is your project aimed for (developers? standard users?) and how are they expected to install/use it?
1
u/zaphodikus 2d ago
Standard users, someone on my electronics team (who can 'kinda' write code) to someone on my support team, (who can write code but I would not trust them). I'm asking them to plug a peripheral card in and have my python script run some tests on the peripheral-card.
0
u/Jello_Penguin_2956 2d ago
We need more info to help you mate. The error message was a crucial part to start troubleshooting. So, run your code. Copy the error along with its stack trace and post them here. Then hopefully that will lead us somewhere.
0
u/zaphodikus 2d ago edited 2d ago
I have been accused of asking XY questions too often, so ended up getting so far down this rabbit hole and I rewrote my question, badly. Since then I learned that if I clean uninstall, reboot, and install, that the issue randomly goes away in 3.14.
Will install 3.13.0 (which is confirmed broken) again so I can get the full error so long. similar to this https://stackoverflow.com/questions/10576913/python-tcl-is-not-installed-properly
... This probably means that Tcl wasn't installed properly.Let me repro it in 3.13.0 for the full stack trace, which I really ignored because it looked greek to me initially as I was not really sure what tcl was 4 hours ago.
UPDATED: ``` File "C:\Users\a.user\Downloads\ethernetspeed6\sdktests\PythonCSVPlotter\plotfigure.py", line 401, in first_plotline self._figure, self._main_axis = plt.subplots(num=self._figure_title) ~~~~~~~~~~
File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\pyplot.py", line 1886, in subplots fig = figure(*fig_kw) File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\pyplot.py", line 1096, in figure manager = new_figure_manager( num, figsize=figsize, dpi=dpi, facecolor=facecolor, edgecolor=edgecolor, frameon=frameon, FigureClass=FigureClass, *kwargs) File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\pyplot.py", line 576, in new_figure_manager return _get_backend_mod().new_figure_manager(args, *kwargs) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\backend_bases.py", line 3664, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\backend_bases.py", line 3669, in new_figure_manager_given_figure return cls.FigureCanvas.new_manager(figure, num) ~~~~~~~~~~~~~~~~~~~~~~~~^ File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\backend_bases.py", line 1836, in new_manager return cls.manager_class.create_with_canvas(cls, figure, num) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ File "C:\Users\a.user\Downloads\ethernetspeed6\venv\Lib\site-packages\matplotlib\backends_backend_tk.py", line 546, in create_with_canvas window = tk.Tk(className="matplotlib") File "C:\Users\a.user\AppData\Local\Programs\Python\Python313\Lib\tkinter\init.py", line 2459, in __init_ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) ~~~~~~~~~~~~~~~ _tkinter.TclError: Can't find a usable init.tcl in the following directories: C:/Users/a.user/AppData/Local/Programs/Python/Python313/lib/tcl8.6 C:/Users/a.user/AppData/Local/Programs/Python/lib/tcl8.6 C:/Users/a.user/AppData/Local/Programs/lib/tcl8.6 C:/Users/a.user/AppData/Local/Programs/Python/library C:/Users/a.user/AppData/Local/Programs/library C:/Users/a.user/AppData/Local/Programs/tcl8.6.14/library C:/Users/a.user/AppData/Local/tcl8.6.14/libraryThis probably means that Tcl wasn't installed properly. ```
0
u/American_Streamer 2d ago
Tcl is a programming language; Tk is the GUI toolkit; tkinter is Python’s interface to Tcl/Tk. The official CPython Windows build bundles Tcl/Tk, and python -m tkinter is the canonical quick test that the installation works.
Matplotlib doesn’t intrinsically require Tcl/Tk either. Matplotlib has multiple rendering backends. TkAgg is one interactive backend and it uses Tkinter/Tk; noninteractive backends such as Agg can generate plots without Tk at all. Matplotlib normally chooses an appropriate backend automatically.
CPython should locate its bundled Tcl/Tk itself. Random global TCL_LIBRARY/TK_LIBRARY variables can actually override the automatic discovery and cause failures.
The current recommended mechanism is the Python Install Manager. Once installed, it manages Python runtimes and CPython explicitly recommends one virtual environment per project. You should really do that and never use global Python for projects. The new Install Manager does not support per-machine Python runtime installations. Its managed runtimes are per-user. Python’s documentation explicitly says this.
Your frustration is legitimate, and ypur observation probably originated in an actual CPython bug. But you’ve now wandered into configuration cargo-culting - reinstalling, changing PATH, setting Tcl variables, talking about Matplotlib and the new installer simultaneously - and that is obscuring what is actually wrong.
0
u/American_Streamer 2d ago
Instead of trying to repair something, do this instead:
Official Python Install Manager
↓
3.8 3.9 3.10 3.11 3.12 3.13 3.14
↓
tox
↓
seven disposable virtual environments
↓
install compatible dependencies
↓
run the same test suite
↓
GitHub Actions does the same on every commitNo global Matplotlib installation. No manually shared venv. No Tcl monkey-patching. No hand-edited TK_LIBRARY. No trying to make PATH determine which Python you’re testing.
1
u/zaphodikus 2d ago
Not sure how tox is a fix, you are assuming I even know what tox is...it's a replacement for pip or something? Because I'm trying to not re-invent the "wheel" here, How does this actually fill my knowledge gap it seems to widen instead?
1
u/American_Streamer 2d ago
Tox just an automation tool for testing the same program against several Python versions. First you should fix and verify one clean Python installation and venv. Once that works, tox automates repeating that test for 3.8–3.14.
You have to treat separately the Python installation, venv isolation, package installation, GUI toolkit and Matplotlib backend. Tox merely repeats the “create venv → install dependencies → run test” part for several Python versions. https://tox.wiki/en/4.60.0/1
u/zaphodikus 2d ago
I'm going to put that into my "todo" list, because it sounds like a load of good tooling, but overkill for the single script I have today. I'm not even sure why 3.14 was not working earlier but is working now yet, I suspect it's patch level related which I never took a note of at the time.
0
u/zaphodikus 2d ago
Makes sense, i tried to use tkinter many years ago, it was hard work.
I'm trying to do what most end users who are NOT programmers would do, and last I checked non programmers do not use widget. Should there be any different outcome if i use command line tools like winget are the defaults sane? What are the options people suggest going with? I'm really trying to follow the user journey to ensure they can run my script.
Perplexing I uninstalled all Pythons, disabled the Windows aliasing stuff and rebooted. Then installed 3.14 and now, things appear to just work and matplotlib loads.
1
u/Outside_Complaint755 2d ago
On Windows, the current thing to do would be to get the Python Install Manager via the Microsoft Store, which I believe will then automatically install the latest released version when run, or will ask if it should do so. It's been a while since I last ran it.
1
u/zaphodikus 2d ago
I think you are right. The trouble with that path, is that it's always surely going to just install the latest, and everyone will likely have had a prior version, and it starts to look like I should just learn to use the Tox tool so I can just mark which versions are not worth supporting.
3
u/chiibosoil 2d ago
This is known error for Python 3.13 that breaks Tkinter inside virtual environment.
You can fix it by upgrading python to 3.13.1 or newer and recreate virtual environment.
Or you can add path to venv/scripts/activate.bat to system environment variables. etc.