Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cupy version installation #4279

Closed
leyojoseph opened this issue Nov 13, 2020 · 12 comments
Closed

Cupy version installation #4279

leyojoseph opened this issue Nov 13, 2020 · 12 comments

Comments

@leyojoseph
Copy link

Hello,
I have Nvidia tesla K40 and nvidia cuda toolkit 11.1 installed on windows 10 HP Z440 machine.
My pip list command shows ==>

(base) PS C:> pip list
Package Version


alabaster 0.7.12
anaconda-client 1.7.2
anaconda-navigator 1.9.12
anaconda-project 0.8.3
argh 0.26.2
asn1crypto 1.3.0
astroid 2.4.2
astropy 4.0.1.post1
atomicwrites 1.4.0
attrs 19.3.0
autopep8 1.5.3
Babel 2.8.0
backcall 0.2.0
backports.functools-lru-cache 1.6.1
backports.shutil-get-terminal-size 1.0.0
backports.tempfile 1.0
backports.weakref 1.0.post1
bcrypt 3.1.7
beautifulsoup4 4.9.1
bitarray 1.4.0
bkcharts 0.2
bleach 3.1.5
bokeh 2.1.1
boto 2.49.0
Bottleneck 1.3.2
brotlipy 0.7.0
certifi 2020.6.20
cffi 1.14.0
chardet 3.0.4
click 7.1.2
cloudpickle 1.5.0
clyent 1.2.2
colorama 0.4.3
comtypes 1.1.7
conda 4.8.3
conda-build 3.18.11
conda-package-handling 1.7.0
conda-verify 3.4.2
contextlib2 0.6.0.post1
cryptography 2.9.2
cupy-cuda110 8.1.0
cusignal 0.17.0a0+29.ga3e5293
cycler 0.10.0

When I run cupy related code, getting below message ==>

CuPy is not correctly installed.

If you are using wheel distribution (cupy-cudaXX), make sure that the version of CuPy you installed matches with the version of CUDA on your host.
Also, confirm that only one CuPy package is installed:
$ pip freeze

If you are building CuPy from source, please check your environment, uninstall CuPy and reinstall it with:
$ pip install cupy --no-cache-dir -vvvv

Check the Installation Guide for details:
https://docs.cupy.dev/en/latest/install.html

original error: cannot import name syncdetect

When trying to install cupy getting below message ==>
(base) PS C:> pip install cupy
Collecting cupy
Using cached cupy-8.1.0.tar.gz (5.9 MB)
ERROR: Command errored out with exit status 1:
command: 'C:\ProgramData\Anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ljoseph\AppData\Local\Temp\pip-install-7p8mxhug\cupy\setup.py'"'"'; file='"'"'C:\Users\ljoseph\AppData\Local\Temp\pip-install-7p8mxhug\cupy\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\ljoseph\AppData\Local\Temp\pip-pip-egg-info-ottojt2h'
cwd: C:\Users\ljoseph\AppData\Local\Temp\pip-install-7p8mxhug\cupy
Complete output (43 lines):
Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'wheel_metadata': None, 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False, 'use_hip': False}

-------- Configuring Module: cuda --------
Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\ljoseph\AppData\Local\Temp\pip-install-7p8mxhug\cupy\setup.py", line 126, in <module>
    ext_modules = cupy_setup_build.get_ext_modules()
  File "C:\Users\ljoseph\AppData\Local\Temp\pip-install-7p8mxhug\cupy\cupy_setup_build.py", line 764, in get_ext_modules
    extensions = make_extensions(arg_options, compiler, use_cython)
  File "C:\Users\ljoseph\AppData\Local\Temp\pip-install-7p8mxhug\cupy\cupy_setup_build.py", line 510, in make_extensions
    raise Exception('Your CUDA environment is invalid. '
Exception: Your CUDA environment is invalid. Please check above error log.

************************************************************
* CuPy Configuration Summary                               *
************************************************************

Build Environment:
  Include directories: ['C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\include\\cub', 'C:\\Users\\ljoseph\\AppData\\Local\\Temp\\pip-install-7p8mxhug\\cupy\\install\\../cupy/core/include', 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\include', 'C:\\Program Files\\NVIDIA Corporation\\NvToolsExt\\include']
  Library directories: ['C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\bin', 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\lib\\x64', 'C:\\Program Files\\NVIDIA Corporation\\NvToolsExt\\lib\\x64']
  nvcc command       : ['C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\bin/nvcc.exe']

Environment Variables:
  CFLAGS          : (none)
  LDFLAGS         : (none)
  LIBRARY_PATH    : (none)
  CUDA_PATH       : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1
  NVTOOLSEXT_PATH : C:\Program Files\NVIDIA Corporation\NvToolsExt\
  NVCC            : (none)
  ROCM_HOME       : (none)

Modules:
  cuda      : No
    -> Include files not found: ['cublas_v2.h', 'cuda.h', 'cuda_profiler_api.h', 'cuda_runtime.h', 'cufft.h', 'curand.h', 'cusparse.h', 'nvrtc.h']
    -> Check your CFLAGS environment variable.

ERROR: CUDA could not be found on your system.
Please refer to the Installation Guide for details:
https://docs.cupy.dev/en/stable/install.html

************************************************************

----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
(base) PS C:>

How to get cupy version 8.0 installed on my PC

@leofang
Copy link
Member

leofang commented Nov 13, 2020

This issue is originated from rapidsai/cusignal#284. @leyojoseph in the initial discussion we thought you're on CUDA 11.0, but based on your latest report here and there it seems you're actually on 11.1? Could you confirm which version you have?

For CUDA 11.1, you should do pip install cupy-cuda111 instead of cupy-cuda110.

For building from source (pip install cupy, as opposed to above which brings down the pre-built wheel), I think it's worth checking if your CUDA_PATH is pointing to the correct place or not. But if the wheel works for you, you would not need to build from source.

@evanmayer
Copy link

evanmayer commented Nov 13, 2020

For CUDA 11.1, you should do pip install cupy-cuda111 instead of cupy-cuda110.

Seconding this! The CUDA Toolkit version and Cupy wheel you request and install must match exactly. When I tested cusignal Windows install, getting this right was the last stumbling block. There are a lot of ways to do it wrong, and pip install cupy-cudaXXX worked for me. I tested on CUDA 10.1, and used pip install cupy-cuda101.

@leyojoseph
Copy link
Author

Thanks ..
Let me please ask you a basic question as I am just learning this. The command pip-install cupy -cuda111 installs cupy -cuda11.1
Will this also install basic cupy version 8.1?.Looks like it is not. So do ineed to install cupy again using pip -install cupy?

As shown below, i have Nvidia tool kit 11.1
(base) C:\Windows\system32>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:54:10_Pacific_Daylight_Time_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.relgpu_drvr455TC455_06.29190527_0

This is what I am getting with pip install cupy -cuda111

(base) C:\Windows\system32>pip install cupy-cuda111
Collecting cupy-cuda111
Using cached cupy_cuda111-8.1.0-cp38-cp38-win_amd64.whl (69.4 MB)
Requirement already satisfied: fastrlock>=0.3 in c:\programdata\anaconda3\lib\site-packages (from cupy-cuda111) (0.5)
Requirement already satisfied: numpy>=1.15 in c:\programdata\anaconda3\lib\site-packages (from cupy-cuda111) (1.18.5)
Installing collected packages: cupy-cuda111
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\ProgramData\Anaconda3\Lib\site-packages\cupy\_util.cp38-win_amd64.pyd'
Consider using the --user option or check the permissions.

@leyojoseph
Copy link
Author

This is the path variable set up in my PC

Capture

@evanmayer
Copy link

evanmayer commented Nov 13, 2020

If you’re using a fresh conda env, you should be able to call pip install cupy-cuda111 only. You don’t need to do Cupy 8.1 first, and in fact you shouldn’t - Cupy docs say the versions can conflict with one another. If you’re not using a fresh conda env you should remove any previously installed Cupy, which you can identify with pip freeze like the Cupy install docs say. I would just try to get it working in a fresh conda env first.

Your most recent error looks like a permissions error. If you’re using the “Anaconda prompt” command window, try closing it, right click > run as Administrator, and trying again.

@leyojoseph
Copy link
Author

Thanks a lot... Could you please explain little bit on what you mean by "Fresh Conda env"...also hwo to do this to get the fresh conda environment. Appreciate your help

@evanmayer
Copy link

conda create —name cusignal-dev
conda activate cusignal-dev

should do it.

https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

@leyojoseph
Copy link
Author

One more question on this please..
After installing cupy -conda111,, what is the best way to install cusignal? Is it pip -install cusignal (I think cusignal support this now).
Making sure that I am doing everything correct..

@evanmayer
Copy link

Let’s confirm first that you have Cupy installed correctly so this issue can be closed. Cupy docs should have some examples you can follow to test this without having cusignal installed.

@leyojoseph
Copy link
Author

Hello,
created a new environment "gpu" and installed everything as shown below==>

(gpu) C:\Windows\System32>conda list

packages in environment at C:\ProgramData\Anaconda3\envs\gpu:

Name Version Build Channel

alabaster 0.7.12 py_0
argh 0.26.2 py38_0
astroid 2.4.2 py38_0
async_generator 1.10 py_0
atomicwrites 1.4.0 py_0
attrs 20.3.0 pyhd3eb1b0_0
autopep8 1.5.4 py_0
babel 2.8.1 pyhd3eb1b0_0
backcall 0.2.0 py_0
bcrypt 3.2.0 py38he774522_0
blas 1.0 mkl
bleach 3.2.1 py_0
brotlipy 0.7.0 py38he774522_1000
ca-certificates 2020.10.14 0
certifi 2020.6.20 pyhd3eb1b0_3
cffi 1.14.3 py38h7a1dbc1_0
chardet 3.0.4 py38haa95532_1003
cloudpickle 1.6.0 py_0
colorama 0.4.4 py_0
cryptography 3.1.1 py38h7a1dbc1_0
cudatoolkit 11.0.221 h74a9793_0
cupy-cuda111 8.1.0 pypi_0 pypi
cusignal 0.17.0a0+29.ga3e5293 pypi_0 pypi

Tried running the below example program==>
import cupy as cp
import numpy as np
import cusignal

start = 0
stop = 10
num_samps = int(1e8)
resample_up = 2
resample_down = 3

Generate Data on CPU

cx = np.linspace(start, stop, num_samps, endpoint=False)
cy = np.cos(-cx**2/6.0)

%%time

gf = cusignal.resample_poly(cp.asarray(cy), resample_up, resample_down, window=('kaiser', 0.5))

Getting below error==>
Traceback (most recent call last):

File "C:\dpd\Python\DLA_Split band\cusig_example.py", line 16, in
gf = cusignal.resample_poly(cp.asarray(cy), resample_up, resample_down, window=('kaiser', 0.5))

File "C:\ProgramData\Anaconda3\envs\gpu\lib\site-packages\cusignal-0.17.0a0+29.ga3e5293-py3.8.egg\cusignal\filtering\resample.py", line 422, in resample_poly
y = upfirdn(h, x, up, down, axis)

File "C:\ProgramData\Anaconda3\envs\gpu\lib\site-packages\cusignal-0.17.0a0+29.ga3e5293-py3.8.egg\cusignal\filtering\resample.py", line 521, in upfirdn
return ufd.apply_filter(x, axis)

File "C:\ProgramData\Anaconda3\envs\gpu\lib\site-packages\cusignal-0.17.0a0+29.ga3e5293-py3.8.egg\cusignal\filtering_upfirdn_cuda.py", line 214, in apply_filter
_populate_kernel_cache(out.dtype, k_type)

File "C:\ProgramData\Anaconda3\envs\gpu\lib\site-packages\cusignal-0.17.0a0+29.ga3e5293-py3.8.egg\cusignal\filtering_upfirdn_cuda.py", line 137, in _populate_kernel_cache
_cupy_kernel_cache[(str(np_type), k_type)] = _get_function(

File "C:\ProgramData\Anaconda3\envs\gpu\lib\site-packages\cusignal-0.17.0a0+29.ga3e5293-py3.8.egg\cusignal\utils\helper_tools.py", line 57, in _get_function
return module.get_function(func)

File "cupy\core\raw.pyx", line 464, in cupy.core.raw.RawModule.get_function

File "cupy\core\raw.pyx", line 89, in cupy.core.raw.RawKernel.kernel.get

File "cupy\core\raw.pyx", line 106, in cupy.core.raw.RawKernel._kernel

File "cupy_util.pyx", line 49, in cupy._util.memoize.decorator.ret

File "cupy\core\raw.pyx", line 533, in cupy.core.raw._get_raw_module

File "cupy\cuda\function.pyx", line 220, in cupy.cuda.function.Module.load_file

File "cupy_backends\cuda\api\driver.pyx", line 237, in cupy_backends.cuda.api.driver.moduleLoad

File "cupy_backends\cuda\api\driver.pyx", line 124, in cupy_backends.cuda.api.driver.check_status

CUDADriverError: CUDA_ERROR_FILE_NOT_FOUND: file not found

Please help me figure out my mistake

@leofang
Copy link
Member

leofang commented Nov 14, 2020

Hi @leyojoseph, looks like your cupy is working? Could you verify a pure CuPy code like this (based on yours with a small modification) can run without error?

import cupy as cp

start = 0
stop = 10
num_samps = int(1e8)

cx = cp.linspace(start, stop, num_samps, endpoint=False)
cy = cp.cos(-cx**2/6.0)
print(cy)

If so you should close this issue, and continue the discussion on cuSignal in rapidsai/cusignal#284 like @evanmayer did.

@leyojoseph
Copy link
Author

Hello,
I tried the above code and is working fine. As you suggested, I will continue the discussion at cusignal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants