pytorch
a719bb0e - Readme: Fix for outdated build-from-source documentation (#91861)

Commit
1 year ago
Readme: Fix for outdated build-from-source documentation (#91861) ## `pip install -r requirements.txt` in build-from-source documentation This line https://github.com/pytorch/pytorch/blob/81b5eff3c383f5308416e129861a2689d717702c/README.md?plain=1#L182-L188 Is outdated. Let's default to `requirements.txt` ### My problem Without touching this codebase for years I'm trying to build repo for local development and run unit tests. I go to `build from source => Contributing.md`. I immediately run into various problems. * [Contributing.md](https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md#developing-pytorch) suggests one way of setting up environment different from [README.md#from-source](https://github.com/pytorch/pytorch/blob/master/README.md#from-source) that does not work for me. * [README.md#from-source](https://github.com/pytorch/pytorch/blob/master/README.md#from-source) suggests a different set of dependencies than [`requirements.txt`](https://github.com/pytorch/pytorch/blob/master/requirements.txt), many of which are unnecessary, and there's still missing ones to run unit tests. * Dependencies in `requirements.txt` are needed to run unit tests So there's competing, inlined and outdated equally confident recommendations on how to set up. https://github.com/pytorch/pytorch/pull/91850 tries to remove one recommendation, this PR tries to make the default one simpler. ### Goals * Improve society somewhat :grin: * Remove a dead end roundtrip in the developer onboarding funnel * Update a duplicated & outdated line of documentation * Two broken things => one broken thing * Improve doc maintainability and nudge us to a productive discussion of what `requirements.txt` is there for. ### Non-goals * Give a definite recommendation how to set up your machine for local development. I read the instructions in readme at this moment as an outline on how to do it. * Say that `requirements.txt` is a definite guide to dependencies, I know it's not (but probably should be) ### Background * Dependency handling/reproducibility in this repo is tricky! See geist of [this](https://github.com/pytorch/pytorch/blob/fdbbd20f3289b2878f2fbad3f77bff1ddd375b28/.github/requirements/README.md). There's many different sets of dependencies with different setups for different environments. * There's been great attempts of _"one requirements.txt to rule them all"_ which got halted https://github.com/pytorch/pytorch/pull/60697/ see https://github.com/pytorch/pytorch/issues/61375 * The unofficial `requirements.txt` file seem to be .circleci/docker/requirements-ci.txt https://github.com/pytorch/pytorch/issues/72556 * Unofficial _"how to build from source"_ docs seem to be here https://github.com/pytorch/pytorch/tree/master/.circleci#how-to-build-a-binary-locally ### Considered alternatives * a) Point only to python dependencies in `requirements.txt` **(Chosen option)** ``` conda install cmake ninja pip install -r requirements.txt ``` This guarantees `python setup.py` to run (on my machine) and gets me one step closer to be able to `python test/run_test.py` * b) Only add whats needed to `python setup.py install`. Point to `Contributing.md` for explanations on how to run tests (which doesn't exactly mention how yet). ``` conda create -n pytorch-source python cmake ninja pyyaml typing_extensions conda activate pytorch-source python setup.py develop ``` * c) Add dependencies needed to run (most) unit tests I assume _"Install from source"_ describes how to "install so I can do development.". This is why we recommend `python setup.py develop`. Doing development implies running unit tests. ``` conda create -n pytorch-source python cmake ninja pytest click conda activate pytorch-source pip install -r requirements.txt xdoctest python setup.py develop python test/run_test.py --keep-going ``` This still eclectically goes outside the simple principle _"Use dependencies in requirements.txt"_ without solving the whole problem. Instructions to get tests to run is not the goal of this PR. * d) Point to ex [`.circleci/docker/requirements-ci.txt`](https://github.com/pytorch/pytorch/blob/master/.circleci/docker/requirements-ci.txt) or any of the system-specific sets of pinned requirements like [`requirements-{conda-env-macOS-ARM64}.txt`](https://github.com/pytorch/pytorch/blob/master/.github/requirements/conda-env-macOS-ARM64) I don't want to jump into this rabbit hole. <details> <summary>My system according to setup.py when verifying it runs</summary> ``` Target system: Darwin-21.6.0 Target processor: arm64 Host system: Darwin-21.6.0 Host processor: arm64 Detected C compiler: AppleClang @ /Library/Developer/CommandLineTools/usr/bin/cc CMake: 3.22.1 Make program: /opt/homebrew/Caskroom/miniconda/base/envs/pytorch-source/bin/ninja Python version : 3.10.8 Python executable : /opt/homebrew/Caskroom/miniconda/base/envs/pytorch-source/bin/python Pythonlibs version : 3.10.8 Python library : /opt/homebrew/Caskroom/miniconda/base/envs/pytorch-source/lib/libpython3.10.a Python includes : /opt/homebrew/Caskroom/miniconda/base/envs/pytorch-source/include/python3.10 Python site-packages: lib/python3.10/site-packages ``` </details> See details in comments below. [skip ci] Pull Request resolved: https://github.com/pytorch/pytorch/pull/91861 Approved by: https://github.com/malfet, https://github.com/ZainRizvi
Author
Committer
Parents
Loading