Bioconductor / basilisk

Clone of the Bioconductor repository for the basilisk package.
https://bioconductor.org/packages/devel/bioc/html/basilisk.html
GNU General Public License v3.0
27 stars 14 forks source link

`CMD build` failure on Linux ARM64 #22

Closed martin-g closed 1 year ago

martin-g commented 1 year ago

Hello!

Env:

I need an advice what could be the problem with the following failure:

...
==> WARNING: A newer version of conda exists. <==
  current version: 4.12.0
  latest version: 23.1.0

Please update conda by running

    $ conda update -n base -c defaults conda

Quitting from lines 294-313 (motivation.Rmd) 
Error: processing vignette 'motivation.Rmd' failed with diagnostics:
one node produced an error: '/tmp/RtmpCFB0iC/Rbuild65fce678e0ba4/basilisk/vignettes/basilisk-vignette-test2/bin/python' was not built with a shared library.
reticulate can only bind to copies of Python built with '--enable-shared'.
--- failed re-building ‘motivation.Rmd’

SUMMARY: processing the following file failed:
  ‘motivation.Rmd’

Error: Vignette re-building failed.

According to reticulate the used version of Python is:

> library(reticulate)  
>  reticulate::py_discover_config()
python:         /usr/bin/python3
libpython:      /usr/lib/python3.10/config-3.10-aarch64-linux-gnu/libpython3.10.so
pythonhome:     //usr://usr
version:        3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
numpy:          /usr/local/lib/python3.10/dist-packages/numpy
numpy_version:  1.24.1

NOTE: Python version was forced by RETICULATE_PYTHON

And Python reports this:

$ python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_config_var('Py_ENABLE_SHARED')
1
$ ll /usr/lib/python3.10/config-3.10-aarch64-linux-gnu/libpython3*
-rw-r--r-- 1 root root 8826302 Nov 14 16:10 /usr/lib/python3.10/config-3.10-aarch64-linux-gnu/libpython3.10.a
-rw-r--r-- 1 root root 9246870 Nov 14 16:10 /usr/lib/python3.10/config-3.10-aarch64-linux-gnu/libpython3.10-pic.a
lrwxrwxrwx 1 root root      42 Nov 14 16:10 /usr/lib/python3.10/config-3.10-aarch64-linux-gnu/libpython3.10.so -> ../../aarch64-linux-gnu/libpython3.10.so.1

Any ideas what I could tweak to make it work ? Thanks!

vjcitn commented 1 year ago

I think this can be defeated ... may take a couple of days to get to it.

On Mon, Mar 6, 2023 at 7:45 AM Martin Grigorov @.***> wrote:

Hello!

I need an advice what could be the problem with the following failure https://yikun.github.io/bioconductor-0301/report/basilisk/kunpeng1-buildsrc.html :

...

==> WARNING: A newer version of conda exists. <==

current version: 4.12.0

latest version: 23.1.0

Please update conda by running

$ conda update -n base -c defaults conda

Quitting from lines 294-313 (motivation.Rmd)

Error: processing vignette 'motivation.Rmd' failed with diagnostics:

one node produced an error: '/tmp/RtmpCFB0iC/Rbuild65fce678e0ba4/basilisk/vignettes/basilisk-vignette-test2/bin/python' was not built with a shared library.

reticulate can only bind to copies of Python built with '--enable-shared'.

--- failed re-building ‘motivation.Rmd’

SUMMARY: processing the following file failed:

‘motivation.Rmd’

Error: Vignette re-building failed.

According to reticulate the used version of Python is:

library(reticulate)

reticulate::py_discover_config()

python: /usr/bin/python3

libpython: /usr/lib/python3.10/config-3.10-aarch64-linux-gnu/libpython3.10.so

pythonhome: //usr://usr

version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]

numpy: /usr/local/lib/python3.10/dist-packages/numpy

numpy_version: 1.24.1

NOTE: Python version was forced by RETICULATE_PYTHON

And Python reports this:

$ python3

Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux

Type "help", "copyright", "credits" or "license" for more information.

import sysconfig

sysconfig.get_config_var('Py_ENABLE_SHARED')

1

Any ideas what I could tweak to make it work ? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/LTLA/basilisk/issues/22, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDI5QVCBQLQSI6BI3A6Q23W2XL6DANCNFSM6AAAAAAVRCKV4I . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance  HelpLine at http://www.partners.org/complianceline http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.

LTLA commented 1 year ago
reticulate can only bind to copies of Python built with '--enable-shared'.

I've never seen this before. I'm guessing that Python 3.8 does not build in a happy manner on Arm:

https://github.com/LTLA/basilisk/blob/be72de15b4a7ed458cc772c95ced5a33856853c0/vignettes/motivation.Rmd#L305

Maybe someone could fiddle with these versions to get something that works on Arm with a more recent Python, and then we can just stick that in the vignette.

martin-g commented 1 year ago

I will do the testing ! Thanks for the hint!

martin-g commented 1 year ago

The build passes fine with

diff --git a/vignettes/motivation.Rmd b/vignettes/motivation.Rmd
index 4491b5e..ba78271 100644
--- a/vignettes/motivation.Rmd
+++ b/vignettes/motivation.Rmd
@@ -302,7 +302,7 @@ if (!file.exists(tmp2)) {
         basilisk.utils::getCondaDir(), 
         basilisk.utils::getCondaBinary()
     )
-    conda_install(tmp2, packages=c("scipy==1.9.1"), python_version="3.8", conda=conda.bin)
+    conda_install(tmp2, packages=c("scipy==1.9.1"), python_version="3.10", conda=conda.bin)
 }

 basiliskRun(env=tmp2, fun=function(mat) {

Is this change OK ? Or should I add a logic like if linux-aarch64 3.10 else 3.8 ?