Skip to content

[Python][C++][GPU] Python Cuda jobs fail with 'cuda.bindings.driver.CUcontext' object has no attribute 'value' #49437

Open

Description

@raulcd

Describe the bug, including details regarding any error messages, version, and platform.

The CUDA Python jobs have started failing on the nightly builds:

There are plenty of errors part of the output:

 _____________ ERROR at setup of test_pyarrow_jit[int16-numba.cuda] _____________

module = <module 'pyarrow.tests.test_cuda_numba_interop' from '/arrow-dev/lib/python3.10/site-packages/pyarrow/tests/test_cuda_numba_interop.py'>

    def setup_module(module):
        np.random.seed(1234)
        ctx1 = cuda.Context()
        nb_ctx1 = ctx1.to_numba()
        nb_ctx2 = nb_cuda.current_context()
>       ctx2 = cuda.Context.from_numba(nb_ctx2)

arrow-dev/lib/python3.10/site-packages/pyarrow/tests/test_cuda_numba_interop.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'cuda.bindings.driver.CUcontext' object has no attribute 'value'

pyarrow/_cuda.pyx:84: AttributeError
___________ ERROR at setup of test_pyarrow_jit[float32-pyarrow.cuda] ___________

module = <module 'pyarrow.tests.test_cuda_numba_interop' from '/arrow-dev/lib/python3.10/site-packages/pyarrow/tests/test_cuda_numba_interop.py'>

    def setup_module(module):
        np.random.seed(1234)
        ctx1 = cuda.Context()
        nb_ctx1 = ctx1.to_numba()
        nb_ctx2 = nb_cuda.current_context()
>       ctx2 = cuda.Context.from_numba(nb_ctx2)

arrow-dev/lib/python3.10/site-packages/pyarrow/tests/test_cuda_numba_interop.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'cuda.bindings.driver.CUcontext' object has no attribute 'value'

pyarrow/_cuda.pyx:84: AttributeError
____________ ERROR at setup of test_pyarrow_jit[float32-numba.cuda] ____________

module = <module 'pyarrow.tests.test_cuda_numba_interop' from '/arrow-dev/lib/python3.10/site-packages/pyarrow/tests/test_cuda_numba_interop.py'>

    def setup_module(module):
        np.random.seed(1234)
        ctx1 = cuda.Context()
        nb_ctx1 = ctx1.to_numba()
        nb_ctx2 = nb_cuda.current_context()
>       ctx2 = cuda.Context.from_numba(nb_ctx2)

arrow-dev/lib/python3.10/site-packages/pyarrow/tests/test_cuda_numba_interop.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'cuda.bindings.driver.CUcontext' object has no attribute 'value'

I haven't investigated whether a third party dependency version difference can be the issue but looks like it.

Component(s)

C++, Python, GPU

Activity

  1. added a commit that references this issue on Mar 4, 2026
  2. removed their assignment
    on Mar 4, 2026
  3. raulcd commented on Mar 4, 2026

    @raulcd
    MemberAuthor

    This is related to this changes:

    I tried a naive approach that I was pretty sure it wasn't going to work :) From what I can see we should handle both the from_numba and to_numba cases for the ctypes changes for numba-cuda 0.28. As we are also wrapping the handles on ctypes.c_void_p(self.handle)

    FYI @gmarkall @pitrou

  4. raulcd commented on Mar 23, 2026

    @raulcd
    MemberAuthor

    This has been failing for 3 weeks, @gmarkall @cpcloud @kkraus14 any idea on how to fix this?

  5. adamreeve commented on Mar 25, 2026

    @adamreeve
    Contributor

    I had a quick look at this. The change in #49446 partly fixes the problem, but the context returned from pyarrow.cuda.Context.to_numba behaves differently to the one from numba.cuda.current_context().

    The one from to_numba still has a handle with a value attribute, but the one from numba.cuda doesn't. This change fixes the tests for me but I'm not very familiar with this area of the code and this feels like a workaround rather than a proper fix. I would think that the context from to_numba should behave like the one from numba.cuda.

  6. pitrou commented on Jun 29, 2026

    @pitrou
    Member
  7. contentis commented on Aug 19, 2026

    @contentis

    I started to look into this and from what I can tell most of the reported issues arrise from "legacy" handling of CUDA context in numba-cuda<0.28 where .value was being used vs. the new (arguably better way) of using the CUContext objects from the cuda.bindings.- Writing a compatibility wrapper for both representations should resolve this. However, my honest preference would be to require numba-cuda >=0.28 and rely entirely on native CUcontext to keep the code lean and clean.

    Supporting both would require some handler like

    def unwrap_numba_handle(handle):
        if hasattr(handle, "value"): # legacy
            return handle.value
        return get_cuda_native_handle(handle) # new >= 0.28
    
    def wrap_numba_handle(address):
    ....
    

    Would this be acceptable, or are there strong reasons to retain compatibility with numba-cuda<0.28?
    Similarly, I think it may be worth dropping CUDA 11.x coverage and focusing on CUDA 12.x and 13.x instead, especially since current numba-cuda no longer provides a CUDA 11 extra.

  8. raulcd commented on Aug 20, 2026

    @raulcd
    MemberAuthor

    I think it may be worth dropping CUDA 11.x coverage and focusing on CUDA 12.x and 13.x instead

    You mean for the Python CUDA jobs? Sounds reasonable to me.
    For the C++ packages we are still shipping some libarrow-cuda packages for some distros, i.e ubuntu-jammy, which use CUDA 11.

    As per the fix, when I did some initial investigation I saw the API had several changes so a wrapper here sounds reasonable to me.

    Thanks for taking a look at this @contentis

  9. raulcd commented on Oct 27, 2026

    @raulcd
    MemberAuthor

    Since the 2nd of March 2026 the Python CUDA jobs have been failing. Should we just remove them? It's been 8 months failing at this point.
    @pitrou @rok

  10. pitrou commented on Oct 27, 2026

    @pitrou
    Member

    Random ping @gmarkall @kkraus14 Do you know someone that cares about PyArrow on CUDA? Otherwise we'll end up removing CI support (and may deprecate the actual code).

  11. added
    Status: confirmed
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions