You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code fails to run and I get this error message.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (c++) is not compatible with the compiler Pytorch was
built with for this platform, which is g++ on linux. Please
use g++ to to compile your extension. Alternatively, you may
compile PyTorch from source using c++, and then you can also use
c++ to compile your extension.
platform=sys.platform))
Traceback (most recent call last):
File "test.py", line 10, in
from invert import *
File "/home/ycjung/Downloads/git/StyleCariGAN/invert.py", line 12, in
from exaggeration_model import StyleCariGAN
File "/home/ycjung/Downloads/git/StyleCariGAN/exaggeration_model.py", line 7, in
from model import PixelNorm, EqualLinear, ConstantInput, StyledConv, ToRGB, ExaggerationLayer
File "/home/ycjung/Downloads/git/StyleCariGAN/model.py", line 13, in
from op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
File "/home/ycjung/Downloads/git/StyleCariGAN/op/init.py", line 1, in
from .fused_act import FusedLeakyReLU, fused_leaky_relu
File "/home/ycjung/Downloads/git/StyleCariGAN/op/fused_act.py", line 15, in
os.path.join(module_path, "fused_bias_act_kernel.cu"),
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 661, in load
is_python_module)
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 841, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1052, in _import_module_from_library
return imp.load_module(module_name, file, path, description)
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/ycjung/.conda/envs/stylecarigan/lib/python3.7/site-packages/torch/../../../libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /tmp/torch_extensions/fused/fused.so)
Analysis
The testing code internally invokes g++ and compiles external modules in op/, which contains several cpp and cu files. The invoked g++ is installed on your system and is probably new (In my case it was 11.1.0). The g++ used for compiling PyTorch 1.3.1 in anaconda environment is old and does not produce binaries compatible with the external module compiled with the new g++.
Troubleshooting
It seems libtorch.so in pytorch/pytorch package is compiled with GCC 7.3.1. So install GCC 7.3.0 in your anaconda environment. (7.3.1 is not in anaconda)
conda install -c anaconda gxx_linux-64=7.3.0
Then run the code with environment variables specifying GCC compilers installed in the conda environment
! WARNING !!
Environment
Anaconda environment under Arch Linux.
Python = 3.7 with other requirements with matching versions specified in the README.
(Pytorch=1.3.1)
Steps I took
Run the test.py with
Expectation
The code should run without error
What I get
The code fails to run and I get this error message.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (c++) is not compatible with the compiler Pytorch was
built with for this platform, which is g++ on linux. Please
use g++ to to compile your extension. Alternatively, you may
compile PyTorch from source using c++, and then you can also use
c++ to compile your extension.
See https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md for help
with compiling PyTorch from source.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
platform=sys.platform))
Traceback (most recent call last):
File "test.py", line 10, in
from invert import *
File "/home/ycjung/Downloads/git/StyleCariGAN/invert.py", line 12, in
from exaggeration_model import StyleCariGAN
File "/home/ycjung/Downloads/git/StyleCariGAN/exaggeration_model.py", line 7, in
from model import PixelNorm, EqualLinear, ConstantInput, StyledConv, ToRGB, ExaggerationLayer
File "/home/ycjung/Downloads/git/StyleCariGAN/model.py", line 13, in
from op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
File "/home/ycjung/Downloads/git/StyleCariGAN/op/init.py", line 1, in
from .fused_act import FusedLeakyReLU, fused_leaky_relu
File "/home/ycjung/Downloads/git/StyleCariGAN/op/fused_act.py", line 15, in
os.path.join(module_path, "fused_bias_act_kernel.cu"),
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 661, in load
is_python_module)
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 841, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1052, in _import_module_from_library
return imp.load_module(module_name, file, path, description)
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/ycjung/.conda/envs/stylecarigan/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/ycjung/.conda/envs/stylecarigan/lib/python3.7/site-packages/torch/../../../libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /tmp/torch_extensions/fused/fused.so)
Analysis
The testing code internally invokes g++ and compiles external modules in
op/
, which contains severalcpp
andcu
files. The invoked g++ is installed on your system and is probably new (In my case it was 11.1.0). The g++ used for compiling PyTorch 1.3.1 in anaconda environment is old and does not produce binaries compatible with the external module compiled with the new g++.Troubleshooting
It seems libtorch.so in pytorch/pytorch package is compiled with GCC 7.3.1. So install GCC 7.3.0 in your anaconda environment. (7.3.1 is not in anaconda)
Then run the code with environment variables specifying GCC compilers installed in the conda environment
This solution got the code running fine. I hope it does to your environment!
The text was updated successfully, but these errors were encountered: