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.1 means R 4.6.2, packaging revision 1.

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.

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.

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.

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

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 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.1 and tag v4.6.2.1 bundle R 4.6.2, with packaging revision 1. 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.1 -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.1

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.1
File Size Uploaded Provenance Actions
r4py-4.6.2.1.tar.gz 32.3 kB With provenance Details for r4py-4.6.2.1.tar.gz

Built distributions (wheels)

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

Total release size: 428.5 MB

Release files / r4py-4.6.2.1.tar.gz

Download URL r4py-4.6.2.1.tar.gz
Size 32.3 kB
Tags Source
SHA-256 checksum
How to use checksums
495a2492226eeb36da7f0a02209957539689ac0016c8ddc5e3a3ec28b4a1e295
BLAKE2b-256 checksum
How to use checksums
3d32e763ecd081b9917f119a2f61a63edde910f0e25236ba637935700a05142a
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 15, 2026.

Transparency log

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

Download URL r4py-4.6.2.1-py3-none-win_amd64.whl
Size 99.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
aff53c661e36faac4fe0142370e0a238cb50397747ab6cacb0cb360591ec66ad
BLAKE2b-256 checksum
How to use checksums
2f30e90bbf6fd71b9e9db1ab64e819659593d39efc6307144066e5e15da77f98
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 15, 2026.

Transparency log

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

Download URL r4py-4.6.2.1-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
5c2e8ea706ad0856a4a26d14e37bc04065181d7de8af738af96ff9f6388c2484
BLAKE2b-256 checksum
How to use checksums
63f68570ab6445e0f7db1b0e8da332c15fe148edbd51faf61a68d8eed3e9ef7b
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 15, 2026.

Transparency log

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

Download URL r4py-4.6.2.1-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
28c34d78fbd88138e4472475fcfa6cd395ccf5adcab5f1c933f6abc47ba197ab
BLAKE2b-256 checksum
How to use checksums
4f54338e3f0b24b555a60191fc9a082da28b8468071590daf7e7dba9104886a8
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 15, 2026.

Transparency log

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

Download URL r4py-4.6.2.1-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
da7374cd33a19c750275a8d52e722c8f5d1383c1b15f4632e511f04a67cb75fe
BLAKE2b-256 checksum
How to use checksums
7d397374834a4b1f40f536d609cc96ebcf316ae05ca80b3ab6ce675eaf687173
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 15, 2026.

Transparency log

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

Download URL r4py-4.6.2.1-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
412f8bd71d263b8b5efceb4f5c3f0987c4aee647c6e3d22aa20e8cc7cc54965b
BLAKE2b-256 checksum
How to use checksums
271c359ef47369a77cb41b6090e15a659ea199e16c1946cc5726ea528ed93c2e
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 15, 2026.

Transparency log

Security for r4py 4.6.2.1

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.1.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 15, 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