Skip to main content

Python snakes combined with the R logo

R, ready to roll.

A complete R runtime in a Python wheel.

PyPI Python 3.10+ R 4.6.2 Wheels Platforms Licenses: MIT and GPL-2.0-or-later

No system R installation. No runtime dependencies on Python packages. No downloads on import. No changes to your process environment.

Install

pip install r4py

Wheels contain R 4.6.2, base and recommended packages, libR, headers, help files, and R CMD tools. The Windows wheel omits the CRAN uninstaller and combined reference-manual PDF; individual package help and manuals remain included. Version 4.6.2.3 means R 4.6.2, packaging revision 3.

The release workflow targets:

Platform Architectures
Linux, glibc 2.28+ x86-64, ARM64
macOS 15+ Intel, Apple Silicon
Windows 10+ x86-64

Linux wheels are repaired with auditwheel; macOS wheels with delocate. Alpine/musl and Windows ARM64 are not supported. Python 3.10+ is required.

Why r4py?

r4py System R / conda R rpy2
Install pip install r4py OS package manager or conda needs an existing R
Bundles R yes yes no
Python-to-R object bridge no no yes
Best for running R/Rscript from Python projects and CI general R work in-process R calls

r4py pairs well with rpy2 when you want a pinned R runtime and an object bridge.

Python

from subprocess import run
from r4py import R, R_HOME, R_VERSION, RSCRIPT

print(R_HOME)  # pathlib.Path to the bundled R installation
print(R_VERSION)  # (4, 6, 2)

run([RSCRIPT, "--vanilla", "-e", "cat(mean(1:10))"], check=True)
run([RSCRIPT, "analysis.R", "input.csv"], check=True)
run([R, "CMD", "config", "CC"], check=True)

The executables locate their own runtime, even if the environment is moved. To override a system R environment or configure a child process:

from r4py import get_env

run(
    [RSCRIPT, "--vanilla", "-e", "cat(R.home())"],
    env=get_env({"R_LIBS_USER": "/path/to/my/R/library"}),
    check=True,
    capture_output=True,
    text=True,
)

get_env() copies os.environ, applies your overrides, then sets the bundled R home, include, share, and documentation paths. It removes inherited R sub-architecture and R loader overrides. It never changes os.environ.

This is a runtime distribution, not a Python-to-R object bridge. Use subprocesses, files, or an independently installed bridge such as rpy2.

Check the installed version with r4py.__version__ (packaging version, e.g. 4.6.2.3) or R_VERSION (bundled R, e.g. (4, 6, 2)). r4py --version is passed through to Rscript and reports R's own version.

Command line

r4py --vanilla -e 'cat(mean(1:10))'
r4py analysis.R input.csv
python -m r4py --vanilla -e 'cat(R.version.string)'
r4py-r                         # interactive R
r4py-r CMD config CC

r4py runs Rscript. r4py-r runs R. Arguments, standard streams, and exit codes are passed through. The launchers do not silently select a system R. R startup files behave normally; use --vanilla for isolated execution.

R packages

Recommended packages, including Matrix, MASS, survival, and lattice, are already included. Install additional packages into a writable library outside the wheel:

r4py --vanilla -e 'lib <- path.expand("~/r4py-library"); dir.create(lib, recursive=TRUE, showWarnings=FALSE); install.packages("jsonlite", lib=lib, repos="https://cloud.r-project.org")'

Set R_LIBS_USER to that directory for subsequent runs. Package installation uses the network. Unix wheels include a CA certificate bundle so HTTPS downloads do not depend on the build machine's certificate paths; set CURL_CA_BUNDLE to use your own PEM certificate bundle. Compiling source packages requires native build tools and any package-specific system libraries; Windows uses Rtools. R CMD config also requires make on Unix. These tools are not bundled. Neither RStudio nor a desktop GUI is included. Headless PDF and PNG graphics are supported.

Troubleshooting

  • No matching distribution found: wheels require Python 3.10+, glibc 2.28+ on Linux, and macOS 15+. Alpine/musl and Windows ARM64 are unsupported; pip falls back to the source distribution, which contains no R.
  • bundled R is missing: you installed the source distribution or are running from a checkout. Install a platform wheel or run build_r_runtime.py.
  • Wrong R or library picked up: use get_env() for child processes, and --vanilla to skip user startup files.
  • Package compilation fails: install native build tools (Rtools on Windows); they are not bundled.

Build and test

uv sync --no-install-project
uv run --no-sync ruff check .
uv run --no-sync pyright
uv run --no-sync pytest -m 'not runtime'
uv run --no-sync python build_r_runtime.py
uv build --wheel

Optional: install the git hooks with uvx pre-commit install. They run ruff, pyright and basic file checks; uv sync --no-install-project must have been run first for pyright.

Unix builds need a C/C++/Fortran toolchain, make, tar, a CA certificate bundle, and development files for curl, bzip2, xz, zlib, PCRE2, ICU, readline, Cairo, PNG, JPEG, and TIFF. For example, use the manylinux container recipe in the wheel workflow. --jobs N controls compilation parallelism. --source-archive PATH uses a local tarball with the same pinned SHA-256 verification.

On Windows, or to reuse a native R installation:

uv run --no-sync python build_r_runtime.py --runtime /path/to/R/home

The builder checks the R version, copies the installation, and makes the Unix launchers relocatable. It refuses to overwrite an existing runtime. Wheel builds fail if the runtime is missing or the R version does not match. Source distributions contain build tooling, not R.

Local builds inherit the host's OS and library requirements. On Unix, repair the wheel before distributing it; the release workflow does this automatically. For a local Linux build:

AUDITWHEEL_LD_LIBRARY_PATH="$PWD/src/r4py/r-runtime/lib" \
  uvx --from auditwheel --with patchelf auditwheel repair --strip \
  -w wheelhouse dist/r4py-*.whl
uv run --no-sync pytest
R4PY_REQUIRE_RUNTIME=1 uv run --no-sync pytest -m runtime
uv run --no-sync python tests/smoke_wheel.py wheelhouse/r4py-*.whl

Without a built runtime, integration tests skip. Release CI requires them, installs each repaired wheel in a path with spaces, hides the original runtime, and tests R execution, recommended native packages, graphics, R CMD on Unix, user-library package installation, and exit codes.

Licensing

r4py's Python code is MIT licensed. Bundled R is GPL-2.0-or-later; its packages and linked libraries retain their own licenses. Do not treat the wheel as MIT-only. The Unix wheel recipes retain dependency license notices and the exact RPM or Homebrew source-package inventory.

R source: R-4.6.2.tar.gz (SHA-256 c297040f6392b1dac6e5c0eb398422cfdaedf540ae2205edb9ad0d10cb10ee00). The build script contains the launcher modifications and is also included in the bundled runtime. Preserve R's COPYING and package notices when redistributing. Binary redistribution must comply with R and dependency source-distribution requirements; linking or embedding R may impose further GPL obligations.

The logo, shown above and included in the source distribution, combines the Python two-snakes device, a trademark of the Python Software Foundation, with the R logo, copyright 2016 The R Foundation. The R artwork and composite arrangement are CC BY-SA 4.0; the R artwork is scaled and layered with the Python device. The Python device retains its original shape and colors and remains subject to the PSF trademark usage policy. Neither foundation's endorsement is implied.

Releases and PyPI

Release each supported stable R version separately: r4py 4.6.2.3 and tag v4.6.2.3 bundle R 4.6.2, with packaging revision 3. Packaging-only fixes increment the fourth component. Keep previous releases available so users can pin their R runtime.

For the first PyPI upload, add a pending publisher at PyPI account publishing:

Field Value
PyPI project name r4py
Repository owner JGalego
Repository name r4py
Workflow filename wheels.yml
Environment name pypi

The workflow's display name is Wheels, but PyPI needs its filename, wheels.yml, without the .github/workflows/ prefix. No PyPI API token is needed.

A release tag builds and tests the source distribution and five wheels without publishing. Once trusted publishing is configured and the release's corresponding source materials are available, run Wheels manually on that tag with publish enabled:

gh workflow run wheels.yml --ref v4.6.2.3 -f publish=true

Publishing uses the pypi GitHub environment. Add required reviewers if the repository's billing plan supports them; otherwise the explicit manual publish input is the release gate. Before publishing, verify third-party notices and make the exact corresponding sources for R and bundled dependencies available alongside the binaries.

Metadata

Release files for r4py 4.6.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for r4py 4.6.2.3
File Size Uploaded Provenance Actions
r4py-4.6.2.3.tar.gz 34.1 kB With provenance Details for r4py-4.6.2.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for r4py 4.6.2.3
File Actions
r4py-4.6.2.3-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for r4py-4.6.2.3-py3-none-win_amd64.whl
r4py-4.6.2.3-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for r4py-4.6.2.3-py3-none-manylinux_2_28_x86_64.whl
r4py-4.6.2.3-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for r4py-4.6.2.3-py3-none-manylinux_2_28_aarch64.whl
r4py-4.6.2.3-py3-none-macosx_15_0_x86_64.whl Python 3 none macOS 15.0+ x86-64 Details for r4py-4.6.2.3-py3-none-macosx_15_0_x86_64.whl
r4py-4.6.2.3-py3-none-macosx_15_0_arm64.whl Python 3 none macOS 15.0+ ARM64 Details for r4py-4.6.2.3-py3-none-macosx_15_0_arm64.whl

Total release size: 428.5 MB

Release files / r4py-4.6.2.3.tar.gz

Download URL r4py-4.6.2.3.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
48ae5c38966ab0a720268c8188caef336c1c1df55d78d9da0dfe9f6b1ae2b975
BLAKE2b-256 checksum
How to use checksums
570dd5458a352ab76ca025a5fdd3a6e26c6859e9eb84952cd5fd39bc5357f94f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.3-py3-none-win_amd64.whl

Download URL r4py-4.6.2.3-py3-none-win_amd64.whl
Size 99.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
e5ffeb63af3ff8fee0509ef03032a117c5cc962bbefb575b4c32085182fd7016
BLAKE2b-256 checksum
How to use checksums
fe623e5e9c50fe6974696f2c145fde386c926a4fed79efcc071d44b05787fc70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.3-py3-none-manylinux_2_28_x86_64.whl

Download URL r4py-4.6.2.3-py3-none-manylinux_2_28_x86_64.whl
Size 82.3 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
dbda94fc2a6ed42ab8e9fea8e49b007264a844fbac336acc913c886a840c0adc
BLAKE2b-256 checksum
How to use checksums
54cb23b5ffb5a5b55da231d91434ea2ee0a57014356a5f51075b6db1007748e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.3-py3-none-manylinux_2_28_aarch64.whl

Download URL r4py-4.6.2.3-py3-none-manylinux_2_28_aarch64.whl
Size 80.6 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
8eaa36b31418800b90b147d5c414437808883348de7ee423a45cffde577edb01
BLAKE2b-256 checksum
How to use checksums
18672f12bd34a85eefe7df285129cb51c30d44d1d9ca4d2e3779cf893cfd777e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.3-py3-none-macosx_15_0_x86_64.whl

Download URL r4py-4.6.2.3-py3-none-macosx_15_0_x86_64.whl
Size 84.1 MB
Tags Python 3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
ff538a8ceff481f23a092938c43d083e912410eceef3849efba017c17ff68357
BLAKE2b-256 checksum
How to use checksums
08d665d2e2347a0ad92b965b8a0388ebd4d11d9febd3c621593946423b3a283d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.3-py3-none-macosx_15_0_arm64.whl

Download URL r4py-4.6.2.3-py3-none-macosx_15_0_arm64.whl
Size 82.3 MB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
b7449f59a5930e61183e141bbd2878b2903f44a9da90c8404a97f027a3181eba
BLAKE2b-256 checksum
How to use checksums
c1a22431fefede82d957faca932d926b07d80a9639d9fd12bfae3d2fb982c8e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for r4py 4.6.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for r4py-4.6.2.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page