cupy: Can't install via Pip

Tried to install via pip install cupy but got the following error:

Collecting cupy
  Using cached cupy-2.3.0.tar.gz
    Complete output from command python setup.py egg_info:
    cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
    cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
    /home/ubuntu/anaconda2/envs/thingy/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lcuda
    Options: {'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False}
    Include directories: ['/usr/local/cuda/include']
    Library directories: ['/usr/local/cuda/lib64']
    Cannot build a stub file.
    Original error: command '/home/ubuntu/anaconda2/envs/thingy/bin/x86_64-conda_cos6-linux-gnu-c++' failed with exit status 1
    **************************************************
    *** WARNING: Cannot link libraries: ['cublas', 'cuda', 'cudart', 'curand', 'cusparse', 'nvrtc', 'nvToolsExt']
    *** WARNING: Skip installing cuda support
    *** WARNING: Check your LDFLAGS environment variable
    **************************************************
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-r2jn275v/cupy/setup.py", line 32, in <module>
        ext_modules = cupy_setup_build.get_ext_modules()
      File "/tmp/pip-build-r2jn275v/cupy/cupy_setup_build.py", line 378, in get_ext_modules
        extensions = make_extensions(arg_options, compiler, use_cython)
      File "/tmp/pip-build-r2jn275v/cupy/cupy_setup_build.py", line 268, in make_extensions
        raise Exception('Your CUDA environment is invalid. '
    Exception: Your CUDA environment is invalid. Please check above error log.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-r2jn275v/cupy/

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Actually, pip install --pre cupy-cuda90 solved the problem.

Cloud you use latest version? You can run pip install cupy --pre command. We improved message during installation. Maybe you can get more useful information.

And, we provides binary package as experimental ( link ).

As we now provide wheels (cupy-cudaXX) for stable releases, generally you don’t have to specify --pre (unless you want to install pre-release (alpha/beta/rc) versions). See the installation guide for details. It now covers the installation steps to install wheels: https://docs-cupy.chainer.org/en/stable/install.html#install-cupy

I’m getting the exact same error message when installing cupy, with CUDA_PATH set correctly. hmm…

Actually, pip install --pre cupy-cuda90 solved the problem. OK, please use it.