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

Possibly numpy2.0 issue? #334

Open
sgosline opened this issue Jul 11, 2024 · 8 comments
Open

Possibly numpy2.0 issue? #334

sgosline opened this issue Jul 11, 2024 · 8 comments

Comments

@sgosline
Copy link

Operating system

Docker container running - r-base:4.3.2 (so, ubuntu, but docker is running on Mac)

Description of the problem

When I load synapser and then reticulate, I get an error trying to use reticulate that looks a lot like the numpy2.0 compatibility issue that just came out:

Error in py_run_file_impl(file, local, convert) : 
  ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Run `reticulate::py_last_error()` for details.

However, when I run the same command without loading synapser, I get no such error.

Expected behavior

My docker container build explicitly calls out numpy==1.26.4, so I should get no error. My only suspicion is that synapser causes another numpy to be loaded.

Actual behavior

However, when I load synapser I get an error, suggesting that numpy2.0 is being installed somewhere.

Error in py_run_file_impl(file, local, convert) : 
  ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Run `reticulate::py_last_error()` for details.

Output of sessionInfo()

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-unknown-linux-gnu (64-bit)
Running under: Debian GNU/Linux trixie/sid

Matrix products: default
BLAS:   /usr/lib/aarch64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblasp-r0.3.25.so;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tidyr_1.3.1        synapser_2.0.0.200 reticulate_1.38.0  stringr_1.5.1     
[5] dplyr_1.1.4        data.table_1.15.4 

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5      cli_3.6.3        rlang_1.1.4      stringi_1.8.4   
 [5] purrr_1.0.2      png_0.1-8        generics_0.1.3   jsonlite_1.8.8  
 [9] glue_1.7.0       rjson_0.2.21     rprojroot_2.0.4  fansi_1.0.6     
[13] grid_4.3.2       tibble_3.2.1     lifecycle_1.0.4  compiler_4.3.2  
[17] codetools_0.2-19 Rcpp_1.0.12      pkgconfig_2.0.3  here_1.0.1      
[21] lattice_0.22-5   R6_2.5.1         tidyselect_1.2.1 utf8_1.2.4      
[25] pillar_1.9.0     magrittr_2.0.3   Matrix_1.6-5     tools_4.3.2     

@sgosline sgosline changed the title Possibly numpy2.0 issio? Possibly numpy2.0 issue? Jul 11, 2024
@sgosline
Copy link
Author

I should say that the error is not when i run python code, just when I load.
The three commands in R that prompt this error are:

library(reticulate)
use_python("/opt/venv/bin/python3", required = TRUE)
source_python("pubchem_retrieval.py")

@thomasyu888
Copy link
Member

thomasyu888 commented Jul 11, 2024

Good to see you here @sgosline !

We actually have a fix for this issue in the upcoming release which should be coming out very soon

Hopefully next 2 weeks. Sorry about that!

@sgosline
Copy link
Author

Thanks @thomasyu888 I'm glad I'm not hallucinating. I tried loading packages in all sorts of orders. Thanks for letting me know.

@danlu1
Copy link
Collaborator

danlu1 commented Jul 15, 2024

Thanks for flagging @sgosline . To resolve the issue, please pin Numpy to version 1.24.4. As Tom said, we already had a fix that would be included in the upcoming release.

@sgosline
Copy link
Author

sgosline commented Jul 15, 2024 via email

@thomasyu888
Copy link
Member

thomasyu888 commented Aug 11, 2024

The newer release should available soon, but it is in staging if you wanted to take a look.

install.packages("synapser", repos=c("http://staging-ran.synapse.org"))

@sgosline
Copy link
Author

OK, i'll wait until it's stable, then update my docker images. I dont want the images to point to staging....

@thomasyu888
Copy link
Member

thomasyu888 commented Aug 26, 2024

Thanks for the wait @sgosline . The new version of synapser should be available for you to install and should also work with the newer versions of R (4.4.1), let us know if you run into any issues.

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

3 participants