无法在R的reticulate中加载pandas,因为缺少GLIBCXX_3.4.29。

huangapple go评论84阅读模式
英文:

Unable to load pandas in R reticulate due to missing GLIBCXX_3.4.29

问题

我正在尝试使用Rreticulate包在R中加载pythonpandas包。

我有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.4GLIBCXX_3.4.28),而GLIBCXX_3.4.29这个ftp中也找不到。

我还尝试了遵循这个SO帖子,通过reticulateR中安装pandasreticulate::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:

&gt; pd &lt;- import(&quot;pandas&quot;)
Error in py_module_import(module, convert = convert) :
  ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29&#39; 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(&quot;pandas&quot;, force = TRUE), which completed, but the pd &lt;- import(&quot;pandas&quot;) 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

huangapple
  • 本文由 发表于 2023年3月7日 06:47:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/75656533.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定