summaryrefslogtreecommitdiff
path: root/CONTRIBUTING.md
diff options
context:
space:
mode:
authorJane Xu <janeyx@fb.com>2020-10-06 10:38:06 -0700
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2020-10-06 10:40:17 -0700
commit3510f19c5fb390976ea6dab9b4f61b0fb564cfb3 (patch)
tree9599ba1a33ef5f507f9cba329a76c3e67db315b2 /CONTRIBUTING.md
parentabedd9a2743c1ed1ae2a8e76196b4f4fe4d0553e (diff)
downloadpytorch-3510f19c5fb390976ea6dab9b4f61b0fb564cfb3.tar.gz
pytorch-3510f19c5fb390976ea6dab9b4f61b0fb564cfb3.tar.bz2
pytorch-3510f19c5fb390976ea6dab9b4f61b0fb564cfb3.zip
added some more details + debugging steps to CONTRIBUTING.md (#45903)
Summary: When attempting to install PyTorch locally on my Macbook, I had some difficulty running the setup steps and understanding what I was really doing. I've added some clarifications and summarized some debugging steps about `python setup.py develop` to lower the barrier of entrance for new contributors. I'm seeking a lot of review here since I am not sure if what I wrote is entirely the most useful or accurate. Thank you! Pull Request resolved: https://github.com/pytorch/pytorch/pull/45903 Reviewed By: albanD Differential Revision: D24140343 Pulled By: janeyx99 fbshipit-source-id: a5e40d1bc804945ae7db2b95ab18cf7fe169e68a
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r--CONTRIBUTING.md28
1 files changed, 27 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b011846039..a1b4096592 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -118,11 +118,37 @@ For example:
- modify your Python file `torch/__init__.py`
- test functionality
-You do not need to repeatedly install after modifying Python files.
+You do not need to repeatedly install after modifying Python files (`.py`). However, you would need to reinstall
+if you modify Python interface (`.pyi`, `.pyi.in`) or non-Python files (`.cpp`, `.cc`, `.cu`, `.h`, ...).
In case you want to reinstall, make sure that you uninstall PyTorch first by running `pip uninstall torch`
and `python setup.py clean`. Then you can install in `develop` mode again.
+### Tips and Debugging
+* A prerequisite to installing PyTorch is CMake. We recommend installing it with [Homebrew](https://brew.sh/)
+with `brew install cmake` if you are developing on MacOS or Linux system.
+* Our `setup.py` requires Python >= 3.6
+* If you run into errors when running `python setup.py develop`, here are some debugging steps:
+ 1. Run `printf '#include <stdio.h>\nint main() { printf("Hello World");}'|clang -x c -; ./a.out` to make sure
+ your CMake works and can compile this simple Hello World program without errors.
+ 2. Nuke your `build` directory. The `setup.py` script compiles binaries into the `build` folder and caches many
+ details along the way, which saves time the next time you build. If you're running into issues, you can always
+ `rm -rf build` from the toplevel `pytorch` directory and start over.
+ 3. If you have made edits to the PyTorch repo, commit any change you'd like to keep and clean the repo with the
+ following commands (note that clean _really_ removes all untracked files and changes.):
+ ```bash
+ git submodule deinit -f .
+ git clean -xdf
+ python setup.py clean
+ git submodule update --init --recursive # very important to sync the submodules
+ python setup.py develop # then try running the command again
+ ```
+ 4. The main step within `python setup.py develop` is running `make` from the `build` directory. If you want to
+ experiment with some environment variables, you can pass them into the command:
+ ```bash
+ ENV_KEY1=ENV_VAL1[, ENV_KEY2=ENV_VAL2]* python setup.py develop
+ ```
+
## Nightly Checkout & Pull
The `tools/nightly.py` script is provided to ease pure Python development of