Repository navigation
Remove nvflare from example requirements.txt and install it first in the docs - #5541
chesterxgchen wants to merge 5 commits into
Conversation
The PyTorch examples' requirements.txt already list torch and torchvision, which is all the PT extra provides, so their READMEs and docs pages install NVFlare alone and then the example's requirements. The source-checkout paths that relied on the extra now install the example requirements too, and the examples command page and hello_world notebook stop teaching framework extras. Co-Authored-By: Claude Code <noreply@anthropic.com>
The notebooks' requirements.txt files no longer name nvflare, so each install cell installs NVFlare first. The homomorphic-encryption chapter lists tenseal directly instead of the nvflare[HE] extra. Co-Authored-By: Claude Code <noreply@anthropic.com>
The research examples' requirements.txt files no longer name nvflare, so their READMEs install NVFlare first. fed-ce lists the PyTorch packages that the PT extra used to provide. research/auto-fl-research is not changed. Co-Authored-By: Claude Code <noreply@anthropic.com>
Examples install NVFlare as stable, nightly or editable before their own dependencies, so a requirements file that names nvflare can replace or downgrade the distribution that nvflare examples get selected the example from; most of these files pinned a release below 2.10. Remove the lines and add the NVFlare install step to every README, docs page and notebook that installs those files. Where an extra supplied packages, list them directly (torch and torchvision for PT, tenseal for HE). Files left with no packages keep a one-line comment, because the integration-test framework requires a requirements.txt. The evo2 environment test, the medical-devices Dockerfile, the qwen3-vl setup steps and two READMEs that pointed at a missing file are updated to match. research/auto-fl-research and AGENTS.md are not changed. Co-Authored-By: Claude Code <noreply@anthropic.com>
The examples overview page and the two amplify job READMEs install requirements files that no longer name nvflare, and the recipe-k8s notice still described a pinned requirement. Co-Authored-By: Claude Code <noreply@anthropic.com>
[Medium impact] The change reaches setup workflows across many examples and learning materials. Enforce the documented minimum NVFlare versions before merging so existing older installations cannot pass setup. Findings
SummarySeparates NVFlare installation from example dependencies across examples, tutorials, and research projects.
Acknowledged exclusions:
Reviews (1) · Last reviewed commit: "docs: finish the NVFlare install step in..." · Reviewed by Greptile |
|
|
||
| ```bash | ||
| # Stable release; use nvflare-nightly for a nightly build, or `-e .` for this checkout | ||
| python3 -m pip install nvflare |
There was a problem hiding this comment.
Older installations pass setup
If a reader already has NVFlare 2.8 installed, pip install nvflare leaves it unchanged. With the version constraint also removed from requirements.txt, setup succeeds but job.py cannot import the required 2.9 APIs. Use pip install "nvflare>=2.9" for the stable path while keeping the nightly and editable alternatives. The same issue appears in research/fed-ce/README.md.
| "# Install NVFlare first (use nvflare-nightly or an editable install if you work with those)\n", | ||
| "! pip install nvflare\n", |
There was a problem hiding this comment.
| python -m pip install -r requirements.txt | ||
| # Install NVFlare first (stable shown; use nvflare-nightly, or "pip install -e ." from a source checkout) | ||
| python -m pip install nvflare | ||
| python -m pip install -r ../requirements.txt |
There was a problem hiding this comment.
Requirements path assumes another directory
The corrected ../requirements.txt path assumes the reader is already inside hello-pt-mlflow, but setup never tells them to enter that directory. The following sections instead show paths from the repository root. State the working directory here, or use the full repository-relative requirements path, so readers following setup from the root do not get a missing-file error.
| python -m pip install -r ../requirements.txt | |
| python -m pip install -r examples/advanced/experiment-tracking/mlflow/requirements.txt |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5541 +/- ##
==========================================
+ Coverage 71.65% 71.66% +0.01%
==========================================
Files 1048 1048
Lines 112323 112323
==========================================
+ Hits 80480 80492 +12
+ Misses 31843 31831 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Example
requirements.txtfiles no longer namenvflare.nvflare examples getselects an example's source revision from the NVFlare distribution that is already installed (stablenvflare,nightly, or an editable checkout), so a requirements line such asnvflare~=2.7.2rccan replace or downgrade that distribution and leave the example out of step with it. Of the 81 requirements files that namednvflare, 58 pinned a release below 2.10. The integration tests already strip these lines (install_requirements.py --exclude nvflare,sed -i '/nvflare\|jupyter\|notebook/d'), so this also removes that workaround's reason to exist.Because
pip install -r requirements.txtno longer installs NVFlare, every document that installs those files now installs NVFlare first.nvflareline. Where an extra supplied packages, list them directly:torchandtorchvisionforPT(only the missing ones),tensealwith the samepython_versionmarkers assetup.cfgforHE. Five files that would be empty keep a one-line comment, becausetests/integration_test/src/example.pyrequires an example to have arequirements.txtandpip install -raccepts a comment-only file.pip install -r <changed file>in a README, docs page or notebook, add a comment andpip install nvflare(or the matching%pip/!pipform). Notebooks keep the magic of the original cell. A script resolved each requirements path, including paths aftercd, and a second check confirms an NVFlare install precedes every such line.hello-pt,hello-lightning,hello-huggingface,collab), theirdocs/hello-worldmirror pages,examples_command.rstandhello_world.ipynbinstall NVFlare alone, since those examples' requirements already listtorchandtorchvision. Source-checkout paths that relied on the extra now install the example requirements too. The invalidnvflare[TF]line inhello_world.ipynbis gone.install_requirements.sh; the evo2 environment test expects the new file contents; the gnn, llm_hf and recipe-k8s READMEs no longer describe removing or pinningnvflare;hello-pt-mlflow's README now points at the parentrequirements.txtthat actually exists.Not changed, on purpose:
research/auto-fl-research(its requirements still namenvflare) andAGENTS.md, whose "Main Branch Versioning" rule about pinning the upcoming NVFlare version in example requirements no longer matches this pattern and should be updated separately.flower_job_structure.rstmentionsnvflare~=2.9.0rcas a job's own requirement, which is a different mechanism. Related: #5328 (README and Quick Start).Types of changes
Testing
python -m pytest -o addopts= -q tests/unit_test/tool/examples tests/unit_test/examples— 372 passed, 7 skipped;examples/advanced/bionemo/evo2/tests/evo2_verify_environment_test.py— 5 passed.nbformatvalidation; every one of the 393 remaining requirement lines parses withpackaging;ci/check_relative_doc_links.py,ci/check_license_header.pyandgit diff --checkpass.auto-fl-researchREADME.pip install --dry-run -ron a comment-only requirements file succeeds.recipe-k8s's version notice), both fixed in the last commit, and no install-path breaks.Not run: a live
nvflare examples getplus install of any example, real package resolution (torch or tenseal wheels), executing any notebook, and the fullruntest.shsuite.Risk
Documentation and dependency files only; no runtime code changes. A reader who runs only
pip install -r requirements.txtfrom an example no longer gets NVFlare, which the updated READMEs, docs pages and notebooks now state first. An example whose README was not updated here and whose environment lacks NVFlare would fail at import time. ThePT-extra removal assumes each example'srequirements.txtlists what its code imports; I checkedtorchandtorchvisionagainst the examples I changed.How to revert
Revert the four commits. No configuration or saved state is affected.
🤖 Generated with Claude Code