-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Difficulty building on macOS #8421
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
Comments
As a hack, can you check if the build works if you change the extension of all the |
That worked! Thank you 😄 |
Although now building successfully, all the tests in
I did install I'm seeing a lot of failures due to |
gif_lib C files breaks the tochvision build also least on Fedora 40 and Mageia 9 for the same 'error: invalid argument '-std=c++17' not allowed with 'C')' error. To me it looks like that the cpp_extension.py from pytorch adds the "std=c++17" compilation flag blindly to all type of files, no matter whether the extension is C or C++. I got it now building with this hack, but something better would be needed.
|
Did this ever get resolved? I tried running the exact same set of commands listed by @joshestein above, using the nightly current main branch of vision and whether I set MACOSX_DEPLOYMENT_TARGET= 10.9 or 11.0 I still get the |
Hi folks. Looks like the mac compiler is unhappy compiling C files while passing C++ flags, while the other compilers just ignore the flags. Perhaps the fix just a matter of renaming the .c files into c++, or compiling the libgif files with separate flags. I don't have access to a mac, so it'll be hard for me to debug or fix this one. I'm happy to review a PR though, if you'd like to submit one. |
More then happy to give it a go as this would make future contribution helps easier! I'll give an initial go tonight be capture more detailed outputs for you to review on the PR since no Mac. On question for you @NicolasHug, on the CONTRIBUTE.md file it calls out for Mac to set target for 10.9. Is there a specific comparability reason or is that just a dated piece of the file? |
That part hasn't been updated in a while, there's a good chance it's not needed anymore or needs to be updated! |
I had the same error and found out that ninja was not installed on my mac (there is a warning to that end in the attached build log above). after running
and rerunning
the error disappears |
I was running into the same installation problem on my Intel Mac and running |
🐛 Describe the bug
I am having difficulty building from source on macOS with an M1 chip. Here is what I've tried:
conda create -n .torchvision_venv python=3.11
conda activate .torchvision_venv
conda install pytorch-nightly::pytorch -c pytorch-nightly
git clone https://github.com/pytorch/vision.git
cd vision
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py develop
This results in the following:
Error output
If I try to target a higher version of macOS (to combat the 'is unavailable: introduced in macOS '), e.g.
_TARGET=11.0
:MACOSX_DEPLOYMENT_TARGET=11.0 CC=clang CXX=clang++ python setup.py develop
I get an error about 'error: invalid argument '-std=c++17' not allowed with 'C')' when trying to use 'dgif_lib.c':
MACOSX_DEPLOYMENT_TARGET=11.0
Error outputIf I try straight
python setup.py develop
I get a similar errorpython setup.py develop
Error outputI have tried a couple other flags (e.g.
USE_METAL=1
,USE_CUDA=0
) but am getting the same errors.Any help will be greatly appreciated!
Versions
Collecting environment information...
PyTorch version: 2.4.0.dev20240510
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 14.4.1 (arm64)
GCC version: Could not collect
Clang version: 15.0.0 (clang-1500.3.9.4)
CMake version: Could not collect
Libc version: N/A
Python version: 3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ] (64-bit runtime)
Python platform: macOS-14.4.1-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Apple M1 Pro
Versions of relevant libraries:
[pip3] torch==2.4.0.dev20240510
[conda] pytorch 2.4.0.dev20240510 py3.11_0 pytorch-nightly
The text was updated successfully, but these errors were encountered: