Let's say I'm making a library called X, which has a dependency on requests (which is under the Apache 2.0 license). For X's setup.py, I declare the following:


Now obviously, I understand that the terms of the Apache License state that I need to include the license, state changes, include copyright, etc. However, since I'm not exactly including the dependency myself (the end user installs it when running pip install X), does this really apply?

In addition, taking the example of requests itself, I notice that it has numerous dependencies, but no licenses seem to be included in the repository itself. Other libraries follow similar practices (not including their dependencies' licenses).

Do I need to include the licenses for dependencies declared in a setup.py?

  • A license is only needed for copying and/or redistributing code. For example, if you developed a program that depends on Microsoft Windows, you would be able to distribute your program to others without ever agreeing to any Microsoft license. Of course, if a third party downloads and installs your program, they may out of technical necessity need to install Windows in order to use your program, and to do that legally they must agree to Microsoft's license(s) in order to install Windows.
    – Brandin
    Commented Sep 20, 2018 at 7:08

1 Answer 1


No, you do not need to include licenses for code that isn't part of your repository.

However, as a service to your users, you can consider mentioning the licenses of your dependencies in the documentation. For this service, it is sufficient to have something along the lines of

This library uses the requests library, which is distributed under the Apache 2.0 license.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.