Issue
I am trying to run CUDA Python examples from https://github.com/NVIDIA/cuda-python.
I have installed CUDA on my system (Ubuntu 18.04):
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Mon_Oct_24_19:12:58_PDT_2022
Cuda compilation tools, release 12.0, V12.0.76
Build cuda_12.0.r12.0/compiler.31968024_0
and have the following packages installed in my virtual env.
Package Version
---------------- -------
cupy-cuda12x 12.3.0
Cython 3.0.8
fastrlock 0.8.2
iniconfig 2.0.0
numpy 1.26.3
packaging 23.2
pip 23.3.2
pluggy 1.3.0
py-cpuinfo 9.0.0
pyclibrary 0.2.1
pyparsing 3.1.1
pytest 7.4.4
pytest-benchmark 4.0.0
setuptools 69.0.3
When runing :
python3 -m pytest
in my virtual env, I get (below is the first error):
================================================================= ERRORS ==================================================================
_________________________________________ ERROR collecting cuda/benchmarks/test_launch_latency.py _________________________________________
ImportError while importing test module '/home/myl/Desktop/cuda-python-main/cuda/benchmarks/test_launch_latency.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
cuda/benchmarks/test_launch_latency.py:9: in <module>
from cuda import cuda
E ImportError: cannot import name 'cuda' from 'cuda' (/home/myl/Desktop/cuda-python-main/cuda/__init__.py)
I tried installing cupy-cuda
instead of cupy-cuda12x
but it did not help.
Solution
You installed cupy-cuda
, but the repo you linked to is for cuda-python
.
Try installing that with pip install cuda-python
.
Answered By - thom747
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.