-
Notifications
You must be signed in to change notification settings - Fork 22.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building from source on OSX without Cuda fails #35478
Comments
Same. I think it may be the problem of Apple compiler. 🤔️ Since brew clang-9 is not compatible with sdk10.15 (no idea why), protobuf compiler can't be compiled with it. A workable solution is to download llvm 10.0.0 release. (deactivate quarantine by xattr -r -d) Then compile PyTorch with llvm-10 like:
I'm installing PyTorch in develop mode, feel free to adjust the installation mode, a little perk is you also get OpenMP work on MacOS. |
@D0miH Does @CaoZhongZ's response resolve your problem? |
Hey guys, thanks for the quick response and sorry for the late reply. So I downloaded the latest llvm 10.0.0 release, unzipped it and moved the resulting folder (here called
However I get the following error message after a few seconds:
What is strange is that the What am I doing wrong? |
I think you'd better specify an absolute path for your clang/clang++ as well as all the -L, -rpath stuff. $llvm10 in my script is a shell variable that'll expand to an absolute path. |
I've been facing the same issue for the last few days. PyTorch 1.4.0 compiled just fine on macOS 10.15.3 with Clang 11.0.0, but with Clang 11.0.3 I get the exact same seg fault as you. I just reported this issue to the Apple Developers, so I'll let you know if I get any feedback. |
That did the trick! Thank you very much @CaoZhongZ.
Great! I hope Apple will find out why this is happening and will fix it. |
Glad to hear a solution was found! |
More of a workaround than a solution... The workaround is not to use the system compiler and instead build your own compiler. You will likely have dozens of other macOS users who stumble on this same problem until Apple Clang is fixed. P.S. Still haven't heard anything back from Apple. |
For the record, I just tried PyTorch 1.5.0 on macOS 10.15.4 with Xcode 11.4.1 and clang-1103.0.32.59 but the build crashes with the same segfault. |
Still tracking this down. It looks like one difference between Apple Clang 11.0.3 and 11.0.0 is that 11.0.3 is based off of LLVM 9.0.0, while 11.0.0 is based off of LLVM 8.0.0: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions. Thanks to @ax3l for pointing this out. So it's possible that this is a LLVM 9.0.0 bug that may or may not have already been fixed and we just need to apply it for Apple Clang 11.0.3 as well. |
Accordingly to a similar issue in OpenBLAS, it is possible that this is LLVM 9.0.0 / AppleClang 11.0.3 only and already fixed in later versions: OpenMathLib/OpenBLAS#2329 . Maybe one should check this again for the specific case here. |
🐛 Bug
I am trying to build PyTorch from source without Cuda on OSX. I am currently on version 10.15 of MacOS and followed the steps at https://github.com/pytorch/pytorch#from-source to build it from source. However, I am not sure whether this is a bug in PyTorch or the problem is on Apple's side.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
PyTorch can be built and is installed.
Environment
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
OS: Mac OSX 10.15.3
GCC version: Could not collect
CMake version: version 3.14.0
Python version: 3.7
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
Versions of relevant libraries:
[pip] numpy==1.18.1
[conda] blas 1.0 mkl
[conda] mkl 2019.4 233
[conda] mkl-include 2020.0 166
[conda] mkl-service 2.3.0 py37hfbe908c_0
[conda] mkl_fft 1.0.15 py37h5e564d8_0
[conda] mkl_random 1.1.0 py37ha771720_0
Additional context
While retrying multiple times I noticed that the build always fails at the
SobolEngineOps
file.Error during the build process:
cc @ezyang @gchanan @zou3519
The text was updated successfully, but these errors were encountered: