Skip to content

[WIP] Address duplicate import issue found in pypi-installed cuda-core packages#2386

Draft
acosmicflamingo wants to merge 1 commit into
NVIDIA:mainfrom
acosmicflamingo:prevent-duplicate-imports
Draft

[WIP] Address duplicate import issue found in pypi-installed cuda-core packages#2386
acosmicflamingo wants to merge 1 commit into
NVIDIA:mainfrom
acosmicflamingo:prevent-duplicate-imports

Conversation

@acosmicflamingo

@acosmicflamingo acosmicflamingo commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #2023

Right now, importing certain modules also imports a duplicate version where the cuda major version number resides in the name (e.g. importing cuda.core.system will mean both cuda.core.system and cuda.core.cu13.system are now in sys.modules).

It's also difficult to reproduce the problem locally. Running pip install . was not giving me the file path I was expecting to write a failing test, which would allow me to assert that the solution I come up with actually works (assuming that the fix involves recompiling cython modules):

# typing.py location from remote pip install
lib/python3.13/site-packages/cuda/core/cu13/system/typing.py

# typing.py location from remote conda install and local pip install
lib/python3.13/site-packages/cuda/core/system/typing.py

I'm going to make it a draft for now so I can do the following:

  • Test that failures does actually occur in CI
  • Test that changing relative imports to absolute imports for cuda.core.system does fix it
  • Utilize linter functionality to ensure the issue is not reintroduced

If it turns out that the problem goes beyond relative imports in cython, then the fix might have to reside here.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@copy-pr-bot

copy-pr-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Jul 17, 2026
@acosmicflamingo

Copy link
Copy Markdown
Contributor Author

@mdboom when you have the chance, can you please run /ok to test for me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relative imports from Cython files in cuda_core cause duplicate imports

1 participant