rstudio / reticulate

R Interface to Python
https://rstudio.github.io/reticulate
Apache License 2.0
1.68k stars 327 forks source link

Compatibility issue with `pkgdown` building vignettes #1026

Open AshesITR opened 3 years ago

AshesITR commented 3 years ago

I have a (currently private) package with a vignette using {reticulate} with miniconda and {keras}. When trying to use pkgdown::build_site(), the building of the vignette fails with an error message that suggests my local sass.so built with my local gcc (gcc --version: 11.1.0) is incompatible with the libstdc++ bundled with miniconda.

Seemingly reticulate causes LD_LIBRARY_PATH to point to this old version of libstdc++.

I'm currently trying to get an MWE but the issue is quite clear to me, I just don't know how to (safely) solve it. Can I just symlink the miniconda libstdc++ to my system libstdc++? Or is there a way to force miniconda to rebuild its libraries with my system gcc (11.1.0)?

Any guidance is welcome.

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/alex/R/x86_64-pc-linux-gnu-library/4.1/sass/libs/sass.so':
  /home/alex/.local/share/r-miniconda/envs/r-reticulate/lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by 
/home/alex/R/x86_64-pc-linux-gnu-library/4.1/sass/libs/sass.so)
Platform Info
$ gcc --version
gcc (GCC) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

R$ reticulate::py_config()
python:         /home/alex/.local/share/r-miniconda/envs/r-reticulate/bin/python
libpython:      /home/alex/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.6m.so
pythonhome:     /home/alex/.local/share/r-miniconda/envs/r-reticulate:/home/alex/.local/share/r-miniconda/envs/r-reticulate
version:        3.6.13 | packaged by conda-forge | (default, Feb 19 2021, 05:36:01)  [GCC 9.3.0]
numpy:          /home/alex/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version:  1.19.5

R$ sessioninfo::platform_info()
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       Arch Linux                  
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language (EN)                        
 collate  en_DK.UTF-8                 
 ctype    en_DK.UTF-8                 
 tz       Europe/Berlin               
 date     2021-07-11     
AshesITR commented 3 years ago

If others encounter this problem, so far I haven't seen any issues with symlinking to the system libstdc++ under /lib64.

In the miniconda environment lib (~/.local/share/r-miniconda/envs/r-reticulate/lib) I ran:

ln -s /lib64/libstdc++.so.6.0.29 libstdc++.so.6.0.29
ln -sf libstdc++.so.6.0.29 libstdc++.so
ln -sf libstdc++.so.6.0.29 libstdc++.so.6