Skip to content

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

@HIEROT

Description

@HIEROT

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions