英文:
Unable to load pandas in R reticulate due to missing GLIBCXX_3.4.29
问题
我正在尝试使用R的reticulate包在R中加载python的pandas包。
我有python3.8,并通过conda安装了pandas。在python中,pandas可以正常导入,但在R中,在加载reticulate后,我收到以下错误信息:
> 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)
我阅读了这个SO帖子,但我的/usr/lib/x86_64-linux-gnu/libstdc++.so.6中没有GLIBCXX_3.4.29(它有GLIBCXX_3.4到GLIBCXX_3.4.28),而GLIBCXX_3.4.29在这个ftp中也找不到。
我还尝试了遵循这个SO帖子,通过reticulate从R中安装pandas:reticulate::py_install("pandas", force = TRUE),安装完成,但pd <- import("pandas")命令仍然出现上述错误。
有什么解决方法吗?
英文:
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?
答案1
得分: 1
我在Amazon Linux 2上遇到了相同的问题。对我有效的一个解决办法是在安装reticulate之前调整LD_LIBRARY_PATH环境变量。具体来说,在我的机器上:
export LD_LIBRARY_PATH=~/anaconda3/lib
虽然这在紧急情况下有效,但我怀疑这不是一个理想的生产环境解决方案。根据我的经验,如果你发现自己不得不调整LD_LIBRARY_PATH,那么可能意味着环境中某些东西(例如链接器选项)没有正确配置。有关更多信息,请参阅:https://www.hpc.dtu.dk/?page_id=1180
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论