0

I am trying to install cupy 5.0.0 using pip. It has dependency on gcc-7. In my system default gcc is set to version 8. I also have cuda-10.0 installed.

I am setting environment variable to use gcc-7 compiler. But nvcc is still using default gcc-8 and giving error.

I cannot use conda environment. I also dont have sudo permission.

Attempt

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

pip3 install cupy==5.0.0

Error Log

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/

Bhaswati Saha
  • 33
  • 1
  • 3
  • Try setting the compiler in `pydistutils.cfg`, as described [here](https://stackoverflow.com/a/16740123/2650249). – hoefling Apr 04 '20 at 09:34
  • You have to explicitly provide nvcc with an option to set the host compiler it will use. See the linked duplicate for different ways to do that – talonmies Apr 04 '20 at 11:14
  • @talonmies I cannot use nvcc command, because it is not installed. And as I said I do not have sudo permission to install it. – Bhaswati Saha Apr 04 '20 at 16:57
  • That can't be true. The output in your question clearly shows nvcc running, so it is installed – talonmies Apr 04 '20 at 17:22
  • Thanks. Finally its is solved by the linked answer. You were right, nvcc was installed, but it was not showing because the path was not added in PATH variable. – Bhaswati Saha Apr 05 '20 at 07:08

0 Answers0