As a general rule, if you use the code, you should cite the code. Citing papers about the code, or random instruction manuals, or even the official documentation doesn't help people reproduce your results, and can actually steal credit from the people who wrote the code, because the papers/manuals/documentation may be written by a very different set of people.
For OSS packages like you're talking about, location doesn't make any sense, and the journal is probably quite capable of dealing with this fact. Rather, citing OSS packages generally involves citing the full name of the code and specific version you used, and where the code came from. Increasingly, OSS authors are coming to realize that it is helpful if they use things like CITATION.cff files, and mint DOIs along with their versions. If they don't, you can usually request such a thing, and often get it. (My guess is that cpython hasn't done this because they don't know how to handle the author list.) But even when this isn't possible, you can usually find a permanent link on sites like github and pypi, and just cite it like any other URL. These are usually short citations; even the date is optional once the version is supplied.
If the authors specify (like scikit-learn) that they want you to cite something else, you should also cite that. This can also be important, because a lot of academic work may have gone into developing the techniques used by the code, which also deserves to be cited. But if there's any divergence between the code described in that reference and the actual version of code that you used, you need to supply more information in the form of a separate, specific reference.