$npx skillfedfor your agent

pytensor

Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs.

With conditionsPyPI MathematicsReleased Aug 20262.2M downloads / moBSD-3-ClausePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytensor-3.3.0-py2.py3-none-any.whl
v3.3.0 · released 2026-08-12 · Python <3.15,>=3.12 · 5 runtime deps: setuptools, scipy, numpy, numba, filelock

Yes, if you need symbolic computation with automatic differentiation and graph optimization. PyTensor is actively maintained, has no known vulnerabilities, installs easily, and is the standard backend for PyMC. Install it if you're doing probabilistic programming, building custom optimized numerical pipelines, or need fine-grained control over computation graphs. Not necessary if you only need eager-mode tensor operations (use NumPy or PyTorch instead).AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction with a pure-Python wheel distribution.
  • Active maintenance with a release within 2 days and recent commits; supports current Python versions (3.12–3.14).
  • Depends on well-established packages: numpy, scipy, numba, setuptools, and filelock.

License · maintenance · safety

BSD-3-Clause (permissive) — BSD-3-Clause is a permissive license; you may use, modify, and distribute PyTensor freely in commercial and private projects provided you include the license notice.

last release 2026-08-12 (2 days) · last repo commit 2026-08-14 · 636 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,197,832 downloads/mo, #3,217 on PyPI

Verify before relying

pip install pytensor

import pytensor
from pytensor import tensor as pt

a = pt.dscalar("a")
b = pt.dscalar("b")
c = a + b
f_c = pytensor.function([a, b], c)
print(f_c(1.5, 2.5))  # Output: 4.0
  • Whether JAX or Numba compilation backends require additional system dependencies or configuration beyond the listed runtime packages.
  • Performance characteristics and memory overhead compared to eager-execution frameworks for typical workloads.
Same gist for agents: .md · .json

What it is and what it does

PyTensor is a symbolic computation library that lets you define mathematical expressions as static graphs, then compile and optimize them before execution. Unlike eager frameworks, you first declare symbolic variables and operations, then convert the graph into a callable function that PyTensor optimizes—removing redundant operations and replacing computations with efficient BLAS routines. It supports automatic differentiation (gradients) and can compile expressions to C, JAX, or Numba for performance.

The library is primarily used as the computational backend for PyMC, a probabilistic programming framework, but works standalone for any numerical computing task involving arrays and mathematical operations. It depends on numpy for array operations, scipy for scientific functions, and numba for JIT compilation; setuptools and filelock are build and locking utilities. The static-graph design allows advanced optimizations that dynamic frameworks cannot perform.

Use it for

  • Build probabilistic models and Bayesian inference pipelines using PyMC, which relies on PyTensor for expression evaluation.
  • Define and optimize complex mathematical expressions (e.g., neural network layers, physics simulations) before compilation.
  • Compute gradients automatically for optimization and machine learning without manually writing backpropagation.
  • Compile symbolic expressions to efficient C or GPU code via JAX or Numba for production inference.
  • Prototype numerical algorithms with symbolic manipulation and graph visualization before deployment.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need symbolic computation with automatic differentiation and graph optimization.

PyTensor is actively maintained, has no known vulnerabilities, installs easily, and is the standard backend for PyMC. Install it if you're doing probabilistic programming, building custom optimized numerical pipelines, or need fine-grained control over computation graphs. Not necessary if you only need eager-mode tensor operations (use NumPy or PyTorch instead).

Install

pytensor on PyPI

Before you install

Low install friction with a pure-Python wheel distribution. Active maintenance with a release within 2 days and recent commits; supports current Python versions (3.12–3.14). Depends on well-established packages: numpy, scipy, numba, setuptools, and filelock.

License in practice

BSD-3-Clause is a permissive license; you may use, modify, and distribute PyTensor freely in commercial and private projects provided you include the license notice.

Quickstart

pip install pytensor

import pytensor
from pytensor import tensor as pt

a = pt.dscalar("a")
b = pt.dscalar("b")
c = a + b
f_c = pytensor.function([a, b], c)
print(f_c(1.5, 2.5))  # Output: 4.0

Verify before relying

  • Whether JAX or Numba compilation backends require additional system dependencies or configuration beyond the listed runtime packages.
  • Performance characteristics and memory overhead compared to eager-execution frameworks for typical workloads.

Package facts

LicenseBSD-3-Clause permissive
Python supportSupports the current Python release <3.15,>=3.12
Install frictionLow. Pure-Python wheel
Runtime dependencies
5 packages
setuptoolsscipynumpynumbafilelock
MaintenanceActively maintained 2 days since the last release
Last repo commit
First released
Downloads2,197,832 / month, #3,217 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 6 - MatureIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Free Threading :: 1 - UnstableTopic :: Scientific/Engineering :: MathematicsTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Compilers

Evidence: pytensor-3.3.0-py2.py3-none-any.whl

Tags

Capabilities
symbolic math expressions pythonautomatic differentiation librarytensor computation frameworkmathematical expression compilernumpy array optimizationgradient computationstatic computation graph
Topics
symbolic-computationautodiffprobabilistic-programming
PyPI keywords
pytensormathnumericalsymbolicblasnumpyautodiffdifferentiation

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “static computation graph”

  • pytensorPyTensor is a Python library for defining, optimizing, and evaluating…
  • torchvizGenerates visual diagrams of PyTorch neural network computation…
  • torchPyTorch provides GPU-accelerated tensor computation and automatic…

Give your agent the search over MCP, or paste the wish link into any chat.

More Mathematics packages

networkx Worth it
PyPI · Python Modules · released Dec 2025

NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.

BSD-3-Clausepure Python
290.9Mdownloads / mo
kiwisolver Worth it
PyPI · Mathematics · released Mar 2026

kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.

Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.

BSD-3-Clausecompiled wheel · 3.10+
205.5Mdownloads / mo
sympy Worth it
PyPI · Scientific/Engineering · released Apr 2025

SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.

BSD-3-Clausepure Python · 3.9+
196.4Mdownloads / mo
contourpy Worth it
PyPI · Information Analysis · released Jul 2025

ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.

BSD-3-Clausecompiled wheel · 3.11+
191.2Mdownloads / mo
torch With conditions
PyPI · Software Development · released Jul 2026

PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.

Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND MITcompiled wheel · 3.10+
102.5Mdownloads / mo
onnxruntime Worth it
PyPI · Software Development · released Jul 2026

onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.

Install it if you have ONNX models to run in production or development.

MITcompiled wheel · 3.11+
89.3Mdownloads / mo

See also pytensor-distributions · Theano-PyMC · Theano · py-expression-eval · numexpr · audmath · casadi · sparsediffpy · jax