cuda-python icon indicating copy to clipboard operation
cuda-python copied to clipboard

No module named 'cuda._lib'; 'cuda' is not a package

Open HIEROT opened this issue 2 years ago • 1 comments

After following the steps on cuda-python to install cuda-python with conda instruction, I try to

from cuda import cuda, nvrtc

as in the example in the pycharm python console, but it raises an error:

Traceback (most recent call last):
  File "D:\Anaconda\envs\hierot\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "D:\PyCharm Community Edition 2022.1.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "cuda\cuda.pyx", line 1, in init cuda.cuda
    # Copyright 2021-2022 NVIDIA Corporation.  All rights reserved.
  File "D:\PyCharm Community Edition 2022.1.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'cuda._lib'; 'cuda' is not a package

But the code above can be successfully run in the terminal

(hierot) D:\Projects\SimPlatform>python
Python 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from cuda import cuda, nvrtc
>>>

Please help me with the problem, thanks in advance. Further information provided on request.

I searched with

ModuleNotFoundError: No module named 'xxx'

Solutions suggest configure correct python interpreter, but I believe my interpreter is already properly configured.

And search with

No module named 'xxx'; 'yyy' is not a package

Some says the cause is the name cuda is shadowed by the package name cuda, I think it might be the problem. Please check this.

HIEROT avatar Nov 21 '22 08:11 HIEROT

might be related to: https://youtrack.jetbrains.com/issue/PY-23417

scottrbrtsn avatar Mar 09 '24 19:03 scottrbrtsn

Sorry for lack of response. Is this still an issue?

leofang avatar Jun 12 '24 03:06 leofang

Closing, please check with PyCharm support for how to proceed. Thanks.

leofang avatar Jun 15 '24 01:06 leofang