Replies: 3 comments
-
|
Standing issue, to document a known issue. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I'm not following at all why an issue was opened and then immediately closed. Wouldn't #1817 close this issue? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I wanted to leave the "Standing issue, to document a known issue." message. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Packages that use
cudaas a namespace package (e.g.cuda-bindings,cuda-core) and define an in-tree build backend viabackend-path=["."]inpyproject.tomlcannotimport cuda.pathfinderat build time, even whencuda-pathfinderis listed inbuild-system.requiresand correctly installed in the build environment.Cause
When a PEP 517 build frontend (
pip install,python -m build) loads an in-tree build backend, it prepends the project directory tosys.path. At that point,import cudaresolves thecudanamespace package to only the project'scuda/subdirectory. Python caches a_NamespacePathforcudainsys.modules. Thecuda/pathfinder/tree installed undersite-packagesis never merged into that namespace, soimport cuda.pathfinderraisesModuleNotFoundError.pkgutil.extend_pathdoes not help:_NamespacePath._recalculate()re-derives its path list from the import machinery's finders, discarding manual additions.Workaround
Replace the
_NamespacePathwith a plainlistthat includes thesite-packages/cuda/directory:This pattern is used in both
cuda_bindings/build_hooks.pyandcuda_core/build_hooks.py. Any other package that usescudaas a namespace and needscuda.pathfinderat build time will need a similar workaround.References
cuda-pathfinderinbuild-system.requires#1803 — original investigation with diagnostic CI output on linux-64, linux-aarch64, and win-64build-system.requires#1817 — PR that introduced the workaround intocuda-bindingsandcuda-coreBeta Was this translation helpful? Give feedback.
All reactions