NVIDIA / cuda-python

CUDA Python Low-level Bindings
https://nvidia.github.io/cuda-python/
Other
809 stars 63 forks source link

No module named 'examples' #38

Closed nyck33 closed 1 year ago

nyck33 commented 1 year ago

I change directories to try to run some examples.

(cython) nyck33@nyck33-IdeaPad-Gaming-3-15ACH6:~/Documents/cuda-start-dec2022/cuda-python/examples/0_Introduction$ python clock_nvrtc_test.py
Traceback (most recent call last):
  File "/home/nyck33/Documents/cuda-start-dec2022/cuda-python/examples/0_Introduction/clock_nvrtc_test.py", line 10, in <module>
    from examples.common import common
ModuleNotFoundError: No module named 'examples'

What am I doing wrong? I am looking at pypi package called absolufy-imports to try to get this going.

MarcoGorelli commented 1 year ago

I haven't tried running this, but you probably just need to run it from the cuda-python folder. Either way, I don't think it's an issue about absolute imports

nyck33 commented 1 year ago

It did not work:

(cython) nyck33@nyck33-IdeaPad-Gaming-3-15ACH6:~/Documents/cuda-start-dec2022/cuda-python$ python examples/0_Introduction/clock_nvrtc_test.py
Traceback (most recent call last):
  File "/home/nyck33/Documents/cuda-start-dec2022/cuda-python/examples/0_Introduction/clock_nvrtc_test.py", line 10, in <module>
    from examples.common import common
ModuleNotFoundError: No module named 'examples'
vzhurba01 commented 1 year ago

https://github.com/NVIDIA/cuda-python#samples

Example tests can be ran with python -m pytest examples. You can use python -m pytest -s examples/0_Introduction/clock_nvrtc_test.py to run a specific example with print captured.