Incidently, can the installer be told to download and install all the modules, so that the user doesn’t have to know/remember to run the “pip3 freeze” command beforehand?
Maybe I’m wrong, but I think you should not run the first command. It will store the current packages in python_requirements.txt. The second command will simulate the install reading from python_requirements.txt. If you overwrite it with your current packages, it will succeed every time.
You should run only the second command with the new python_requirements.txt
The --python-version argument to pip will make it evaluate the dependencies in the context of the given Python version, so it should fail if something in the current set of packages is incompatible with the given version (3.13.1 in the example).