this post was submitted on 04 Aug 2024
60 points (100.0% liked)

Python

6229 readers
33 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

๐Ÿ“… Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

๐Ÿ Python project:
๐Ÿ’“ Python Community:
โœจ Python Ecosystem:
๐ŸŒŒ Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] daco@lemm.ee 1 points 1 month ago (1 children)

Ok. Thank you for the explanation!

I'm just now thinking out los here, but would it make sense to use a PowerShell script to silently install miniconda and create a venv with a specific version?

Something like

@echo off
REM Download Miniconda installer (replace URL with the latest version)
powershell -Command "Invoke-WebRequest https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -OutFile miniconda.exe"

REM Install Miniconda silently
start /wait "" miniconda.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%UserProfile%\Miniconda3

REM Create a new environment with the specific Python version
call %UserProfile%\Miniconda3\Scripts\activate.bat
call conda create -y -n py39 python=3.9

REM Optional: Set permissions for multi-user access
icacls %UserProfile%\Miniconda3 /grant:r Users:(OI)(CI)F /T

More on that here https://docs.anaconda.com/anaconda/install/silent-mode/

Again, this is just an idea, but if this works then you won't have a problem anymore (maybe?).

Well that's one solution.

We wouldn't do this because we have a policy of modifying as little as humanly possible on the target system, because of the nature of some of our customers: we may not have the right to modify stuff right and left willy-nilly on those customer's systems, and if we do, we have to justify why with a lot of paperwork. So we don't: we install our stuff in one very formal, very stable spot of the hard disk (on Windows, c:\Users<username>), install missing modules, stick an icon on the desktop and that's it.

Historically, we also propose to install Python on the system if it's missing (used to do that system-wide) and advise our customers to install it system-wide too if they did it themselves so we wouldn't have to modify our installer (again, if we do, we have to justify the change when the customer is under configuration control, so we try to avoid change). Not anymore obviously.

So yeah, we wouldn't install Miniconda just for the purpose of not changing our installers. At this point, that's enough change that I can just rewrite the installers: either way, I'll have to communicate the change to the customers, so I might as well do it right.

But my point was, if Python gracefully handled backward compatibility - as in, for example, you put in the shebang or near the shebang that you want the interpreter and pip to behave like, say, Python 3.10, and Python4.56 behaves like 3.10 did years later - then this is unnecessary work that I wouldn't have to do.

I had to rewrite our installers and other things to deal with Python 3.12's new forcibly-enforced kosher way ot doing things because it won't do thing any other way and compatibility be damned. That's my beef with Python: after all this time, it's still unstable and prone to breaking existing codebases.

It's a real problem for us and it has been for a long time: code that's out there and working is liable to quit working when the Python interpreter changes. I have no idea how a 33-year-old language, ultra-widely used language such as Python is allowed to change regularly with little regard to backward compatibility like it was an early beta weekend project. This is truly unprofessional and it completely boggles my mind.