I am building PyTorch from source.
I am using Ubuntu 20.04. I have multiple gcc versions installed. I have set the symlinks for “/usr/bin/gcc” and “/usr/bin/g++” so that they will point to “/usr/bin/x86_64-linux-gnu-gcc-9” and “/usr/bin/x86_64-linux-gnu-g+±9”. Earlier it was 7.
So now I get the following outputs for the following commands
gcc --version
:
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ --version
:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
x86_64-linux-gnu-g++ --version
:
x86_64-linux-gnu-g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
x86_64-linux-gnu-gcc --version
:
x86_64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
But when I build pytorch with the command python setup.py develop
, Cmake picks the old gcc version
Building wheel torch-2.3.0a0+gitc378001
-- Building version 2.3.0a0+gitc378001
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/avishka/temp/pytorch/torch -DCMAKE_PREFIX_PATH=/home/avishka/anaconda3/envs/ie2/lib/python3.10/site-packages;/home/avishka/anaconda3/envs/ie2 -DNUMPY_INCLUDE_DIR=/home/avishka/anaconda3/envs/ie2/lib/python3.10/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/home/avishka/anaconda3/envs/ie2/bin/python -DPYTHON_INCLUDE_DIR=/home/avishka/anaconda3/envs/ie2/include/python3.10 -DPYTHON_LIBRARY=/home/avishka/anaconda3/envs/ie2/lib/libpython3.10.a -DTORCH_BUILD_VERSION=2.3.0a0+gitc378001 -DUSE_NUMPY=True /home/avishka/temp/pytorch
FATALGCC-9.4 or newer is required to compile PyTorch, but found 7.5.0
-- /usr/bin/c++ /home/avishka/temp/pytorch/torch/abi-check.cpp -o /home/avishka/temp/pytorch/build/abi-check
...
Any help is highly appreciated.