You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python3.6+R3.4环境下rpy2导入报错:Lookup Error: 'show' not found

Fixing "Lookup Error: 'show' not found" when importing rpy2.robjects with Python 3.6 and R 3.4

I’ve run into this exact compatibility issue before with older Python/R and rpy2 combinations—here’s how to resolve it step by step:

  • Pin rpy2 to a compatible version
    Newer rpy2 releases drop support for Python 3.6 and R 3.4. You need to install a version that explicitly supports this stack. Run these commands in your terminal:

    pip uninstall -y rpy2
    pip install rpy2==2.9.6
    

    Version 2.9.6 is the last stable release that works reliably with Python 3.6 and R 3.4.

  • Set the R_HOME environment variable
    Sometimes rpy2 can’t automatically locate your R installation. On macOS, set the path to your R 3.4 resources folder:

    export R_HOME=/Library/Frameworks/R.framework/Versions/3.4/Resources
    

    To make this permanent, add the line above to your ~/.bash_profile or ~/.zshrc file (depending on your shell) and restart your terminal.

  • Verify R’s core functions are intact
    The "show" error can also happen if R’s base packages are corrupted. Open an R terminal and run:

    show
    

    You should see output like function (object) .Primitive("show"). If not, repair your R installation by reinstalling R 3.4 or running install.packages("base", repos="https://cran.r-project.org") in R.

  • Test the import again
    After completing the steps above, launch Python and try importing again:

    import rpy2.robjects as robjects
    

    The warnings might still appear (they’re often just deprecation notices for older packages), but the "show" lookup error should be gone.

内容的提问来源于stack exchange,提问作者Jessica

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:09:19