1

I'm trying to use R's reticulate package for loading python's pandas package in R.

I have python3.8, and I installed pandas through conda. In python pandas imports fine but in R, after loading reticulate I get this error:

> pd <- import("pandas")
Error in py_module_import(module, convert = convert) :
  ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/mnd/miniconda/lib/python3.8/site-packages/pandas/_libs/window/aggregations.cpython-38-x86_64-linux-gnu.so)

I read through this SO post but my /usr/lib/x86_64-linux-gnu/libstdc++.so.6 does not have GLIBCXX_3.4.29 in it (it has GLIBCXX_3.4 to GLIBCXX_3.4.28), and GLIBCXX_3.4.29 cannot be found in this ftp.

I also tried following this SO post by installing pandas from R with reticulate: reticulate::py_install("pandas", force = TRUE), which completed, but the pd <- import("pandas") command results with the same error above.

Any idea how to solve this?

user1701545
  • 5,706
  • 14
  • 49
  • 80

1 Answers1

1

I encountered the same issue on Amazon Linux 2. One solution that worked for me was to adjust the LD_LIBRARY_PATH environment variable prior to installing reticulate. Specifically on my machine:

export LD_LIBRARY_PATH=~/anaconda3/lib

While this works in a pinch, I am dubious that it's an ideal solution for a production environment. In my experience if you find yourself having to adjust LD_LIBRARY_PATH then it suggests that something (e.g. linker options) may not be properly configured in the environment. For more on this, see for example: https://www.hpc.dtu.dk/?page_id=1180

B. Tyner
  • 83
  • 5