--- id: rpy2 version: "3.6.7" license: GPL-2.0-or-later license_treatment: copyleft maintenance: active --- # rpy2 — Python interface to the R language (embedded R) License: copyleft · Maintenance: active · Downloads: 385.6K/mo ## What it is and what it does rpy2 is a Python-to-R bridge that embeds an R interpreter within Python, letting you execute R code and manipulate R objects from Python without spawning a separate process. It wraps R's C API through rpy2-rinterface and provides high-level object bindings via rpy2-robjects, making it possible to mix R's statistical and data-manipulation capabilities directly into Python workflows. The package is designed for data scientists and researchers who need R's specialized libraries but want to work within a Python environment. It requires R to be installed on your system and handles the bridging between Python and R's runtime, including memory management and type conversion. Installation is straightforward for standard setups, though non-standard R installations may require environment configuration. Use it for: - Call R statistical functions and models from Python without leaving your Python environment or data pipeline. - Use R's specialized packages to process or visualize data already in Python. - Prototype data analysis workflows that combine Python libraries with R capabilities in a single script. - Convert between Python objects and R objects for interoperability. - Embed R computations in Python applications where R's domain expertise is needed but Python is the primary language. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. rpy2 embeds R within Python, allowing you to call R functions and work with R objects directly from Python code without launching a separate R process. Yes, if you need R's capabilities within Python and your project can accept GPL-2.0-or-later licensing. The package is actively maintained, has low install friction (wheel available), and works with modern Python versions (3.9 through 3.13). Not suitable for proprietary projects due to copyleft licensing. Requires R to be installed separately on your system. ## Install pip install rpy2 uv add rpy2 poetry add rpy2 ## Installing rpy2 Before you install: Low friction: pure Python wheel available. Requires R to be installed on your system and accessible in PATH; if R is in a non-standard location, you may need to set LD_LIBRARY_PATH before importing. Active maintenance with recent releases. License in practice: GPL-2.0-or-later (copyleft): any code that links rpy2 must be distributed under GPL-2.0 or later. Proprietary or permissively-licensed projects cannot use this package without accepting copyleft obligations. Quickstart: pip install rpy2 from rpy2.robjects import r result = r('some_r_code') R must be installed and in your system PATH; rpy2-rinterface (a compiled C extension) requires a working R installation with accessible shared libraries. Verify before relying: - Whether optional dependencies (numpy, pandas, ipython) are needed for typical workflows or only for specific use cases. - Performance characteristics when calling R functions repeatedly from Python in tight loops. ## Package facts - License: GPL-2.0-or-later (copyleft) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 385.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python r integration, call r from python, embedded r interpreter, python r bridge, r language bindings, dataframe r python, statistical computing python, statistical-computing, language-interop, data-science [View on SkillFed](https://skillfed.io/packages/rpy2) · [View on PyPI](https://pypi.org/project/rpy2/)