That's one of the main pain points of Python. Something like poetry or uv can help but the python ecosystem is just unstable. It's very hard to update a dependancy. You project might only run with very specific versions of libraries and the language itself.
I honestly hate that about python and I don't think python is good for developing large software. Even js/ts is a much better ecosystem. (I'm bracing for the hate)
Fuck youtube