Hi Experts.
I have seen this posted a few times but I haven't seen a clear answer, so forgive me if reposting (see: Reticulate issues in RStudio Server & python - ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found - Stack Overflow)
I am trying to load a .pickle file with a pandas dataframe into R with reticulate.
However, whenever I try to import pandas, the following error gets thrown:
#Error
pd <- import("pandas")
Error in py_module_import(module, convert = convert) : ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /Users/thomas/Python/mambaforge/lib/python3.10/site-packages/pandas/_libs/window/aggregations.cpython-310-x86_64-linux-gnu.so)
Which I assume stems from trying to call the "default" library path on the server where our RStudio-Server instance is initialized.
I have tried multiple methods to address this in both the rmarkdown in the Quarto document I'm using, and the .Rprofile that is called prior to initializing any part of the project as described below:
#In .Rprofile
Sys.setenv(PATH = paste("/Users/thomas/Python/mambaforge/bin/",Sys.getenv()["PATH"],sep=";"))
Sys.setenv(RETICULATE_PYTHON = "/Users/thomas/Python/mambaforge/bin/python3")
Sys.setenv(LD_LIBRARY_PATH = "/Users/thomas/Python/mambaforge/lib/")
source("renv/activate.R")
#use_python("/Users/thomas/Python/mambaforge/bin/python3")
#In Markdown file
PATH <- Sys.getenv("PATH")
RETICULATE_PYTHON <- Sys.getenv("RETICULATE_PYTHON")
LD_LIBRARY_PATH <- Sys.getenv("LD_LIBRARY_PATH")
use_condaenv(condaenv = "base")
system("export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Users/thomas/Python/mambaforge/lib/")
pd <- import("pandas")
However, the error seems to persist regardless of what path redirection I may call or what environment variables I may actively set.
Would anyone know how I might be able to address this error?
Any help would be greatly appreciated.
Below is the versioning information for the RStudio-Server session, R installation, py_config() output, and server OS.
RStudio Server
2022.07.0+548 "Spotted Wakerobin" Release (34ea3031089fa4e38738a9256d6fa6d70629c822, 2022-07-06) for CentOS 7
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
R Version
version
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 4
minor 2.1
year 2022
month 06
day 23
svn rev 82513
language R
version.string R version 4.2.1 (2022-06-23)
nickname Funny-Looking Kid
py_config() output:
python: /Users/thomas/Python/mambaforge/bin/python3
libpython: /Users/thomas/Python/mambaforge/lib/libpython3.10.so
pythonhome: /Users/thomas/Python/mambaforge:/Users/thomas/Python/mambaforge
version: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
numpy: /Users/thomas/Python/mambaforge/lib/python3.10/site-packages/numpy
numpy_version: 1.25.1
pandas: /Users/thomas/Python/mambaforge/lib/python3.10/site-packages/pandas
NOTE: Python version was forced by RETICULATE_PYTHON
OS Version:
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"