Compiling from source in OSX succeeds but running unit tests fail

Hey guys,

I’m trying to contribute to the pytorch repo and therefore I need to install pytorch from souce with the develop flag.

I followed the OSX specific instructions here and here.

The code compiles, but it generates a bunch of warnings and in the end I am not able to run the unit tests code.

Running test_autograd.py ...
...........................................................................................s..............................................................................................................................................................s..................................................................................................................................................................................................................................................................s...........................................................................................................................................................................................................................................s......................s.....
----------------------------------------------------------------------
Ran 774 tests in 72.297s

OK (skipped=5)
Running test_cpp_extensions.py ...
running install
running build
running build_ext
/Users/miguel/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/utils/cpp_extension.py:91: UserWarning:
Your compiler (g++) may be ABI-incompatible with PyTorch.
Please use a compiler that is ABI-compatible with GCC 4.9 and above.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.
  warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))
building 'torch_test_cpp_extension' extension
gcc -fno-strict-aliasing -I/Users/miguel/anaconda2/envs/pytorch/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/miguel/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/lib/include -I/Users/miguel/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/lib/include/TH -I/Users/miguel/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/lib/include/THC -I/Users/miguel/anaconda2/envs/pytorch/include/python2.7 -c extension.cpp -o build/temp.macosx-10.6-x86_64-2.7/extension.o -g -DTORCH_EXTENSION_NAME=torch_test_cpp_extension -std=c++11
In file included from extension.cpp:1:
In file included from /Users/miguel/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/lib/include/torch/torch.h:5:
In file included from /Users/miguel/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/lib/include/ATen/ATen.h:5:
In file included from /Users/miguel/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/lib/include/ATen/Allocator.h:6:
/Users/miguel/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/lib/include/ATen/Retainable.h:3:10: fatal error: 'atomic' file not found
#include <atomic>
         ^~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
Traceback (most recent call last):
  File "test/run_test.py", line 256, in <module>
    main()
  File "test/run_test.py", line 248, in main
    raise RuntimeError('{} failed!'.format(test_module))
RuntimeError: test_cpp_extensions.py failed!```
1 Like

Sounds like it’s having trouble building test_cpp_extensions.py. If you don’t need the cpp_extensions functionality (many people won’t) then feel free to ignore this.