Pythons virtualenv is old than npm. For me, I think what makes Pythons dependency management work for me is that there's a logical separation between the environment and the package managers. You create a new environment, using venv, pyenv, Conda, containers, whatever you like, doesn't matter, then you install packages into that environment, might be latest, might be a specific version, depends entirely on your needs.
Something like npm og Rubys Gem, are confusing because I have no idea where the packages went. Apparently they like somewhere in the current directory, maybe? What if I want to use the same environment and package elsewhere? I'm sure you can do it, but it doesn't seem logical to me that you don't need to specify which environment you're using. It's the same with Go, it's rather confusing where packages go, or which version, it's all squirreled away in the go command. In one way it is really nice that it just goes into the same project directory, but it's also a little confusing that your environment changes when you move directories.
For production and containers... you normally just have that one thing running, so into the global environment it goes and here using apt to install the packages also ensures security updates, well not in the containers perhaps, unless you rebuild them.