Install & Compatibility
Where this runs
tested against v0.19.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 2.282s · 128.4MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 5.3s · import 2.124s · 125MB
132MB installed
● package 132MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PythranExtension
✓ from pythran import PythranExtension
✗ import compiled_module
compile_pythrancode
✓ from pythran import compile_pythrancode
compile_pythranfile
✓ from pythran import compile_pythranfile
Create a Python file with numerical kernels annotated for export. Compile it using the `pythran` command-line tool, then import the resulting native module. This example defines a dot product function.
# dprod.py
""" Naive dotproduct! Pythran supports numpy.dot """
#pythran export dprod(int list, int list)
def dprod(l0, l1):
"""WoW, generator expression, zip and sum."""
return sum(x * y for x, y in zip(l0, l1))
# To compile the Python file to a native module:
# pythran dprod.py
# Then, import and use the compiled module:
# python -c 'import dprod; print(dprod.dprod([1,2,3], [4,5,6]))'
pythran --version
Debug
Known issues
breakingPythran dropped support for Python 2.7 after version 0.9.5. It now exclusively supports Python 3.7 and upward.fixEnsure your project uses Python 3.7 or newer.
affects: <=0.9.5 (Python 2.7 support), >0.9.5 (Python 3.7+ only)
gotchaPythran only supports a subset of the Python language, specifically targeting numerical computing. Features like classes, polymorphic variables (with some exceptions), and heterogeneous containers (except tuples) are not supported.fixDesign your functions to adhere to Pythran's supported Python subset, typically pure numerical functions operating on primitive types and NumPy arrays.
affects: All versions
gotchaA C++14 enabled compiler (e.g., g++ >= 5, clang >= 3.5) is a prerequisite for Pythran. Older compilers may lead to compilation errors.fixUpdate your system's C++ compiler to a version that supports C++14 standards.
affects: All versions
gotchaFor optimal performance, users often need to explicitly specify compiler optimization flags (e.g., `-O3`, `-fopenmp`, `-march=native`) either via the `pythran` CLI or in a `~/.pythranrc` configuration file.fixConsult Pythran's documentation for recommended optimization flags and consider setting them in `~/.pythranrc` or passing them directly to the `pythran` command.
affects: All versions
deprecatedSupport for `numpy.distutils` with Python 3.9 was obsoleted in Pythran 0.18.0. Users integrating Pythran into larger build systems might need to adapt.fixMigrate build systems away from `numpy.distutils` if targeting Python 3.9+ with Pythran 0.18.0+.
affects: 0.18.0 and later
gotchaWindows support for Pythran is ongoing and primarily targets Visual Studio 2017 or clang-cl. Specific environment variables (`CXX`, `CC`) might be required for proper setup.fixRefer to the Pythran documentation for detailed Windows installation and configuration instructions, especially regarding compiler setup.
affects: All versions on Windows
Upgrade
Version history
0.19.0latest on PyPI · released Aug 17, 2026
Audit
Dependencies
plyrequiredLex & Yacc parsing, required for Pythran's AST processing.
setuptoolsrequiredUsed for building and distributing Pythran extensions, especially via PythranExtension.
gastrequiredPython AST that abstracts the underlying Python version, used in AST transformations.
numpyrequiredCore dependency for numerical operations and array support.
benigetrequiredExtracts semantic information about static Python code, used in Pythran's analysis passes.
boostoptionalC++ library dependency, often vendored in PyPI packages but may be external for other distributions.
xsimdoptionalC++ library for SIMD vectorization, often vendored in PyPI packages.
C++14 enabled compiler (e.g., g++>=5, clang>=3.5)requiredRequired to compile the generated C++ code.