首页 > 解决方案 > 不受支持的 GNU 版本!不支持高于 7 的 gcc 版本

问题描述

我正在尝试使用 pip 安装 cupy 5.0.0。它依赖于 gcc-7。在我的系统中,默认 gcc 设置为版本 8。我还安装了 cuda-10.0。

我正在设置环境变量以使用 gcc-7 编译器。但是 nvcc 仍然使用默认的 gcc-8 并给出错误。

我不能使用 conda 环境。我也没有 sudo 权限。

试图

export CXX=/usr/bin/g++-7
export CC=/usr/bin/gcc-7
export LD=/usr/bin/g++-7

pip3 install cupy==5.0.0

错误日志

Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jhyhll1p/cupy/setup.py", line 176, in <module>
        'sdist': sdist},
      File "/home/bhaswati/.local/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/bhaswati/.local/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.7/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-jhyhll1p/cupy/cupy_setup_build.py", line 773, in run
        build_ext.build_ext.run(self)
      File "/home/bhaswati/.local/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 87, in run
        _build_ext.run(self)
      File "/usr/lib/python3.7/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/usr/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
        self._build_extensions_serial()
      File "/usr/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
        self.build_extension(ext)
      File "/home/bhaswati/.local/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 208, in build_extension
        _build_ext.build_extension(self, ext)
      File "/usr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
        depends=ext.depends)
      File "/usr/lib/python3.7/distutils/ccompiler.py", line 574, in compile
        self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
      File "/tmp/pip-install-jhyhll1p/cupy/cupy_setup_build.py", line 666, in _compile
        base_opts = build.get_compiler_base_options()
      File "/tmp/pip-install-jhyhll1p/cupy/install/build.py", line 157, in get_compiler_base_options
        _compiler_base_options = _get_compiler_base_options()
      File "/tmp/pip-install-jhyhll1p/cupy/install/build.py", line 195, in _get_compiler_base_options
        stderrdata.decode('utf8'))
    RuntimeError: Encountered unknown error while testing nvcc:
    In file included from /usr/local/cuda-10.0/bin/..//include/cuda_runtime.h:83,
                     from <command-line>:
    /usr/local/cuda-10.0/bin/..//include/crt/host_config.h:129:2: error: #error -- unsupported GNU version! gcc versions later than 7 are not supported!
      129 | #error -- unsupported GNU version! gcc versions later than 7 are not supported!
          |  ^~~~~


    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-jhyhll1p/cupy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-kkryni4u/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-jhyhll1p/cupy/

标签: gccpipcudanvcccupy

解决方案


推荐阅读