-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CI][R][Python] R and Python integration's tests failed #39933
Comments
#39942 may be happen by the same cause. |
The timing of this failure starting to show up is around the time version 1.35.0 of reticulate came out and it looks like 1.35.0 was used in during the above failures. |
Can we pin reticulate for now? |
Let me verify my guess, I'll report back. |
I ran the tests in reticulate 1.34.0==> Testing R file using 'testthat'
ℹ Loading arrow
[ FAIL 6 | WARN 0 | SKIP 1 | PASS 1 ]
── Error (test-python-flight.R:28:5): flight_path_exists ───────────────────────
<pyarrow.lib.ArrowInvalid/python.builtin.ValueError/pyarrow.lib.ArrowException/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_iterate(it, f)`: pyarrow.lib.ArrowInvalid: invalid literal for int() with base 10: ''. Detail: Python exception: ValueError
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. ├─testthat::expect_false(flight_obj %in% list_flights(client)) at test-python-flight.R:28:5
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. ├─flight_obj %in% list_flights(client)
5. └─arrow::list_flights(client)
6. └─reticulate::iterate(generator, function(x) as.character(x$descriptor$path[[1]])) at r/R/flight.R:121:3
7. └─reticulate:::py_iterate(it, f)
── Error (test-python-flight.R:33:5): flight_put ───────────────────────────────
<pyarrow.lib.ArrowInvalid/python.builtin.ValueError/pyarrow.lib.ArrowException/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: pyarrow.lib.ArrowInvalid: invalid literal for int() with base 10: ''. Detail: Python exception: ValueError
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. ├─testthat::expect_true(flight_path_exists(client, flight_obj)) at test-python-flight.R:33:5
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─arrow::flight_path_exists(client, flight_obj)
5. ├─base::tryCatch(...) at r/R/flight.R:128:3
6. │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
7. │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
8. │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
9. └─client$get_flight_info(descriptor_for_path(path)) at r/R/flight.R:130:7
10. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Error (test-python-flight.R:43:5): flight_put with max_chunksize ────────────
<pyarrow.lib.ArrowInvalid/python.builtin.ValueError/pyarrow.lib.ArrowException/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: pyarrow.lib.ArrowInvalid: invalid literal for int() with base 10: ''. Detail: Python exception: ValueError
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. ├─testthat::expect_true(flight_path_exists(client, flight_obj)) at test-python-flight.R:43:5
2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
4. └─arrow::flight_path_exists(client, flight_obj)
5. ├─base::tryCatch(...) at r/R/flight.R:128:3
6. │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
7. │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
8. │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
9. └─client$get_flight_info(descriptor_for_path(path)) at r/R/flight.R:130:7
10. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Error (test-python-flight.R:56:5): flight_get ───────────────────────────────
<pyarrow.lib.ArrowInvalid/python.builtin.ValueError/pyarrow.lib.ArrowException/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: pyarrow.lib.ArrowInvalid: invalid literal for int() with base 10: ''. Detail: Python exception: ValueError
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. ├─expect_equal_data_frame(flight_get(client, flight_obj), example_data) at test-python-flight.R:56:5
2. │ ├─expect_equal(as.data.frame(x), as.data.frame(y), ...) at tests/testthat/helper-expectation.R:24:3
3. │ │ └─base::inherits(object, "ArrowObject") at tests/testthat/helper-expectation.R:35:3
4. │ └─base::as.data.frame(x)
5. └─arrow::flight_get(client, flight_obj)
6. └─arrow:::flight_reader(client, path) at r/R/flight.R:96:3
7. └─client$get_flight_info(descriptor_for_path(path)) at r/R/flight.R:102:3
8. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Error (test-python-flight.R:62:5): flight_put with RecordBatch ──────────────
<pyarrow.lib.ArrowInvalid/python.builtin.ValueError/pyarrow.lib.ArrowException/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: pyarrow.lib.ArrowInvalid: invalid literal for int() with base 10: ''. Detail: Python exception: ValueError
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. ├─expect_equal_data_frame(flight_get(client, flight_obj2), example_data) at test-python-flight.R:62:5
2. │ ├─expect_equal(as.data.frame(x), as.data.frame(y), ...) at tests/testthat/helper-expectation.R:24:3
3. │ │ └─base::inherits(object, "ArrowObject") at tests/testthat/helper-expectation.R:35:3
4. │ └─base::as.data.frame(x)
5. └─arrow::flight_get(client, flight_obj2)
6. └─arrow:::flight_reader(client, path) at r/R/flight.R:96:3
7. └─client$get_flight_info(descriptor_for_path(path)) at r/R/flight.R:102:3
8. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Error (test-python-flight.R:66:5): flight_put with overwrite = FALSE ────────
<pyarrow.lib.ArrowInvalid/python.builtin.ValueError/pyarrow.lib.ArrowException/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: pyarrow.lib.ArrowInvalid: invalid literal for int() with base 10: ''. Detail: Python exception: ValueError
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. ├─testthat::expect_error(...) at test-python-flight.R:66:5
2. │ └─testthat:::expect_condition_matching(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─arrow::flight_put(...)
8. └─arrow::flight_path_exists(client, path) at r/R/flight.R:66:3
9. ├─base::tryCatch(...) at r/R/flight.R:128:3
10. │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
11. │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
12. │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
13. └─client$get_flight_info(descriptor_for_path(path)) at r/R/flight.R:130:7
14. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Skipped tests (1) ───────────────────────────────────────────────────────────────────────────────────────────────
• empty test (1): test-python-flight.R:75:3
[ FAIL 6 | WARN 0 | SKIP 1 | PASS 1 ]
Test complete reticulate 1.35.0==> Testing R file using 'testthat'
ℹ Loading arrow
[ FAIL 5 | WARN 0 | SKIP 1 | PASS 2 ]
── Error (test-python-flight.R:32:5): flight_put ───────────────────────────────
<python.builtin.ValueError/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: ValueError: PyCapsule_GetPointer called with incorrect name
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. └─arrow::flight_put(client, example_data, path = flight_obj) at test-python-flight.R:32:5
2. ├─reticulate::r_to_py(data) at r/R/flight.R:73:3
3. └─arrow:::r_to_py.Table(data)
4. ├─reticulate::r_to_py(as_record_batch_reader(x), convert = FALSE) at r/R/python.R:111:3
5. └─arrow:::r_to_py.RecordBatchReader(...)
6. └─pa$lib$RecordBatchReader$`_import_from_c`(pyarrow_compatible_pointer(stream_ptr)) at r/R/python.R:227:3
7. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Error (test-python-flight.R:42:5): flight_put with max_chunksize ────────────
<python.builtin.ValueError/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: ValueError: PyCapsule_GetPointer called with incorrect name
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. └─arrow::flight_put(client, example_data, path = flight_obj, max_chunksize = 1) at test-python-flight.R:42:5
2. ├─reticulate::r_to_py(data) at r/R/flight.R:73:3
3. └─arrow:::r_to_py.Table(data)
4. ├─reticulate::r_to_py(as_record_batch_reader(x), convert = FALSE) at r/R/python.R:111:3
5. └─arrow:::r_to_py.RecordBatchReader(...)
6. └─pa$lib$RecordBatchReader$`_import_from_c`(pyarrow_compatible_pointer(stream_ptr)) at r/R/python.R:227:3
7. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Error (test-python-flight.R:56:5): flight_get ───────────────────────────────
<pyarrow.lib.ArrowKeyError/python.builtin.KeyError/python.builtin.LookupError/pyarrow.lib.ArrowException/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: pyarrow.lib.ArrowKeyError: 'Flight not found.'. Detail: Python exception: KeyError
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. ├─expect_equal_data_frame(flight_get(client, flight_obj), example_data) at test-python-flight.R:56:5
2. │ ├─expect_equal(as.data.frame(x), as.data.frame(y), ...) at tests/testthat/helper-expectation.R:24:3
3. │ │ └─base::inherits(object, "ArrowObject") at tests/testthat/helper-expectation.R:35:3
4. │ └─base::as.data.frame(x)
5. └─arrow::flight_get(client, flight_obj)
6. └─arrow:::flight_reader(client, path) at r/R/flight.R:96:3
7. └─client$get_flight_info(descriptor_for_path(path)) at r/R/flight.R:102:3
8. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Error (test-python-flight.R:61:5): flight_put with RecordBatch ──────────────
<python.builtin.ValueError/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: ValueError: PyCapsule_GetPointer called with incorrect name
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. └─arrow::flight_put(client, RecordBatch$create(example_data), path = flight_obj2) at test-python-flight.R:61:5
2. ├─reticulate::r_to_py(data) at r/R/flight.R:73:3
3. └─arrow:::r_to_py.RecordBatch(data)
4. └─pa$RecordBatch$`_import_from_c`(...) at r/R/python.R:84:3
5. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Error (test-python-flight.R:66:5): flight_put with overwrite = FALSE ────────
<python.builtin.ValueError/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: ValueError: PyCapsule_GetPointer called with incorrect name
Run `reticulate::py_last_error()` for details.
Backtrace:
▆
1. ├─testthat::expect_error(...) at test-python-flight.R:66:5
2. │ └─testthat:::expect_condition_matching(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─arrow::flight_put(...)
8. ├─reticulate::r_to_py(data) at r/R/flight.R:73:3
9. └─arrow:::r_to_py.Table(data)
10. ├─reticulate::r_to_py(as_record_batch_reader(x), convert = FALSE) at r/R/python.R:111:3
11. └─arrow:::r_to_py.RecordBatchReader(...)
12. └─pa$lib$RecordBatchReader$`_import_from_c`(pyarrow_compatible_pointer(stream_ptr)) at r/R/python.R:227:3
13. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
── Skipped tests (1) ───────────────────────────────────────────────────────────────────────────────────────────────
• empty test (1): test-python-flight.R:75:3
[ FAIL 5 | WARN 0 | SKIP 1 | PASS 2 ]
Test complete |
I believe reticulate 1.35.0 changed the "name" of the capsule. I am not sure what it was before and I am not sure what it is now...we started using external pointers on the R side in Arrow 7.0.0, which converted to Python capsules automatically, because it felt better than converting the pointer to an R One of the errors is along the lines of On the R side, we could go back to calling The code on the R side that could change is here: Lines 341 to 353 in 672238f
|
Thanks @paleolimbot. I just checked the diff between 1.34.0 and 1.35.0 and I think you're right on both counts. In rstudio/reticulate@9b2c8d4 the name changed from "NULL" to "r_extptr" and code was added to validate against the name (by calling |
FWIW, the python.R code is not yet using capsules (it's still using |
Got it! It looks like capsules with a null name are accepted...perhaps it should be updated to accept a capsule with NULL or r_extptr? arrow/python/pyarrow/types.pxi Lines 104 to 105 in cd5faaf
|
Or, alternatively, we could fix in R by generating the Python integer there: py <- reticulate::import_builtins(convert = FALSE)
# addr <- external_pointer_addr_double(ptr)
addr <- "12345"
class(py$int(addr))
#> [1] "python.builtin.int" "python.builtin.object"
py$int(addr)
#> 12345 Created on 2024-02-06 with reprex v2.0.2 |
This seems to be about storing R objects inside capsules. This is not what the R-PyArrow bridge is doing, is it? Also, if the name is not |
My understanding is that the And I suppose the array/schema pointers in the R package are "external pointers", and so reticulate automatically puts them in a capsule before passing to |
Ahah, I see. Then I guess it makes sense to make the check more tolerant on the PyArrow side. |
I will also submit a fix on the R side...it didn't occur to me at the time to convert to a Python integer using reticulate to work around the fact that R doesn't have 64-bit integers. If it's easy, it would probably also be a good idea to fix it in Python (or remove the ability to pass a pointer in that way, or fix the comment to reflect the new nature of how an external pointer gets converted using reticulate). |
We should do both, because ideally one can use an older R-Arrow with a newer PyArrow and vice-versa. |
…39969) ### Rationale for this change The integration tests and documentation build is failing ### What changes are included in this PR? Instead of relying on how reticulate converts an R external pointer, use a Python integer instead. We can't use an R integer (because they're only 32 bits); we can't use an R double (because the static cast to/from uintptr_t is a bit iffy); however, we can use Python to convert a string to Python integer. This is probably how I should have written it the first time but it didn't occur to me at the time. ### Are these changes tested? Yes, covered by existing tests. ### Are there any user-facing changes? No * Closes: #39933 Lead-authored-by: Dewey Dunnington <[email protected]> Co-authored-by: Dewey Dunnington <[email protected]> Signed-off-by: Dewey Dunnington <[email protected]>
…ulate (apache#39969) ### Rationale for this change The integration tests and documentation build is failing ### What changes are included in this PR? Instead of relying on how reticulate converts an R external pointer, use a Python integer instead. We can't use an R integer (because they're only 32 bits); we can't use an R double (because the static cast to/from uintptr_t is a bit iffy); however, we can use Python to convert a string to Python integer. This is probably how I should have written it the first time but it didn't occur to me at the time. ### Are these changes tested? Yes, covered by existing tests. ### Are there any user-facing changes? No * Closes: apache#39933 Lead-authored-by: Dewey Dunnington <[email protected]> Co-authored-by: Dewey Dunnington <[email protected]> Signed-off-by: Dewey Dunnington <[email protected]>
…39969) ### Rationale for this change The integration tests and documentation build is failing ### What changes are included in this PR? Instead of relying on how reticulate converts an R external pointer, use a Python integer instead. We can't use an R integer (because they're only 32 bits); we can't use an R double (because the static cast to/from uintptr_t is a bit iffy); however, we can use Python to convert a string to Python integer. This is probably how I should have written it the first time but it didn't occur to me at the time. ### Are these changes tested? Yes, covered by existing tests. ### Are there any user-facing changes? No * Closes: #39933 Lead-authored-by: Dewey Dunnington <[email protected]> Co-authored-by: Dewey Dunnington <[email protected]> Signed-off-by: Dewey Dunnington <[email protected]>
…39969) ### Rationale for this change The integration tests and documentation build is failing ### What changes are included in this PR? Instead of relying on how reticulate converts an R external pointer, use a Python integer instead. We can't use an R integer (because they're only 32 bits); we can't use an R double (because the static cast to/from uintptr_t is a bit iffy); however, we can use Python to convert a string to Python integer. This is probably how I should have written it the first time but it didn't occur to me at the time. ### Are these changes tested? Yes, covered by existing tests. ### Are there any user-facing changes? No * Closes: #39933 Lead-authored-by: Dewey Dunnington <[email protected]> Co-authored-by: Dewey Dunnington <[email protected]> Signed-off-by: Dewey Dunnington <[email protected]>
…ulate (apache#39969) ### Rationale for this change The integration tests and documentation build is failing ### What changes are included in this PR? Instead of relying on how reticulate converts an R external pointer, use a Python integer instead. We can't use an R integer (because they're only 32 bits); we can't use an R double (because the static cast to/from uintptr_t is a bit iffy); however, we can use Python to convert a string to Python integer. This is probably how I should have written it the first time but it didn't occur to me at the time. ### Are these changes tested? Yes, covered by existing tests. ### Are there any user-facing changes? No * Closes: apache#39933 Lead-authored-by: Dewey Dunnington <[email protected]> Co-authored-by: Dewey Dunnington <[email protected]> Signed-off-by: Dewey Dunnington <[email protected]>
…39969) ### Rationale for this change The integration tests and documentation build is failing ### What changes are included in this PR? Instead of relying on how reticulate converts an R external pointer, use a Python integer instead. We can't use an R integer (because they're only 32 bits); we can't use an R double (because the static cast to/from uintptr_t is a bit iffy); however, we can use Python to convert a string to Python integer. This is probably how I should have written it the first time but it didn't occur to me at the time. ### Are these changes tested? Yes, covered by existing tests. ### Are there any user-facing changes? No * Closes: #39933 Lead-authored-by: Dewey Dunnington <[email protected]> Co-authored-by: Dewey Dunnington <[email protected]> Signed-off-by: Dewey Dunnington <[email protected]>
…ulate (apache#39969) ### Rationale for this change The integration tests and documentation build is failing ### What changes are included in this PR? Instead of relying on how reticulate converts an R external pointer, use a Python integer instead. We can't use an R integer (because they're only 32 bits); we can't use an R double (because the static cast to/from uintptr_t is a bit iffy); however, we can use Python to convert a string to Python integer. This is probably how I should have written it the first time but it didn't occur to me at the time. ### Are these changes tested? Yes, covered by existing tests. ### Are there any user-facing changes? No * Closes: apache#39933 Lead-authored-by: Dewey Dunnington <[email protected]> Co-authored-by: Dewey Dunnington <[email protected]> Signed-off-by: Dewey Dunnington <[email protected]>
Describe the bug, including details regarding any error messages, version, and platform.
https://github.com/apache/arrow/actions/runs/7760862085/job/21168058007#step:6:32228
The last success commit: 2721134
The first failed commit: b684028
Commits between them:
@jorisvandenbossche Could you take a look at this PyCapsule related error messages?
Component(s)
Continuous Integration, Python, R
The text was updated successfully, but these errors were encountered: