Skip to content
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

r_to_py leading to matrix error in versions >1.3.5 when using python library metas_unclib #1676

Open
joan-metas opened this issue Sep 25, 2024 · 4 comments

Comments

@joan-metas
Copy link

For reticulate version >1.3.5 (on R 4.4.1) r_to_py leads to a matrix error when using with the python library metas_unclib. This library returns values with uncertainties as shown in the example below. In version 1.3.5 the matrix conversion was working correctly.

library(reticulate)
unc <- import("metas_unclib", delay_load = TRUE)
x <- c(1:3)
cov <- diag(0, NROW(x), NROW(x))
r_to_py(unc$ufloatarray(x, cov))

which returns
[1.0 ± 0.0, 2.0 ± 0.0, 3.0 ± 0.0]

The matrix conversion for metas_unclib objects may have been depricated by later reticulate versions.

@t-kalinowski
Copy link
Member

Hi, can you please provide instructions for how to install "metas_unclib"?

I tried py_install("metas_unclib") and encountered error:

  ModuleNotFoundError: No module named 'clr'

then I tried py_install("clr") and encountered error:

> unc <- import("metas_unclib")
Error in py_module_import(module, convert = convert) : 
  AttributeError: module 'clr' has no attribute 'AddReference'

@joan-metas
Copy link
Author

joan-metas commented Sep 25, 2024 via email

@t-kalinowski
Copy link
Member

t-kalinowski commented Sep 25, 2024

My best guess is that this is due to NumPy 2.0. Have you tried installing older versions of NumPy (and Scipy, and possibly other packages)?

@joan-metas
Copy link
Author

joan-metas commented Sep 26, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants