-
Notifications
You must be signed in to change notification settings - Fork 23k
Debugging PyTorch Build
-
If you run into errors when running
python setup.py develop
, here are some debugging steps:- 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. - Nuke your
build
directory. Thesetup.py
script compiles binaries into thebuild
folder and caches many details along the way, which saves time the next time you build. If you're running into issues, you can alwaysrm -rf build
from the toplevelpytorch
directory and start over. - 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.):
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
- The main step within
python setup.py develop
is runningmake
from thebuild
directory. If you want to experiment with some environment variables, you can pass them into the command:ENV_KEY1=ENV_VAL1[, ENV_KEY2=ENV_VAL2]* python setup.py develop
- Run
-
If you run into issue running
git submodule update --init --recursive
. Please try the following:-
If you encounter an error such as
error: Submodule 'third_party/pybind11' could not be updated
check whether your Git local or global config file contains any
submodule.*
settings. If yes, remove them and try again. (please reference this doc for more info). -
If you encounter an error such as
fatal: unable to access 'https://github.com/pybind11/pybind11.git': could not load PEM client certificate ...
this is likely that you are using HTTP proxying and the certificate expired. To check if the certificate is valid, run
git config --global --list
and search for config likehttp.proxysslcert=<cert_file>
. Then check certificate valid date by runningopenssl x509 -noout -in <cert_file> -dates
-
If you encounter an error that some third_party modules are not checked out correctly, such as
Could not find .../pytorch/third_party/pybind11/CMakeLists.txt
remove any
submodule.*
settings in your local git config (.git/config
of your pytorch repo) and try again.
-
-
If you're a Windows contributor, please check out Best Practices.
-
For help with any part of the contributing process, please don’t hesitate to utilize our Zoom office hours! See details here