{"id":24414,"library":"pytensor-distributions","title":"PyTensor Distributions","description":"PyTensor-powered probability distributions for probabilistic programming and Bayesian inference. Version 0.1.3, released 2025, maintenance level with monthly patches.","status":"active","version":"0.1.3","language":"python","source_language":"en","source_url":"https://github.com/pymc-devs/pytensor-distributions","tags":["pytensor","distributions","probability","bayesian","pymc"],"install":[{"cmd":"pip install pytensor-distributions","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"Core computation engine for tensor operations and automatic differentiation.","package":"pytensor","optional":false},{"reason":"Provides numerical constants and special functions used in distribution implementations.","package":"scipy","optional":false}],"imports":[{"note":"Direct import of Normal from top-level package fails because distributions are in a submodule.","wrong":"from pytensor_distributions import Normal","symbol":"Normal","correct":"from pytensor_distributions.distributions import Normal"},{"note":"The top-level module does not expose distributions directly; must import the submodule.","wrong":"import pytensor_distributions as dist","symbol":"Distributions","correct":"from pytensor_distributions import distributions"}],"quickstart":{"code":"import pytensor\nimport pytensor.tensor as pt\nfrom pytensor_distributions.distributions import Normal\n\nx = pt.dmatrix('x')\nmu = pt.dvector('mu')\nsigma = pt.dscalar('sigma')\ndist = Normal.dist(mu, sigma)\nlogp = dist.log_prob(x)\n\n# Evaluate\nf = pytensor.function([x, mu, sigma], logp)\nprint(f([[1.0, 2.0], [3.0, 4.0]], [0.0, 1.0], 0.5))","lang":"python","description":"Define a Normal distribution and compute log-probability."},"warnings":[{"fix":"Always call `.dist()` on distribution classes to create distribution instances.","message":"The distribution constructors use `.dist()` class method instead of direct instantiation (e.g., `Normal.dist(mu, sigma)` not `Normal(mu, sigma)`). Direct instantiation raises a TypeError.","severity":"breaking","affected_versions":"all"},{"fix":"Use PyMC or other sampling libraries; do not rely on pytensor-distributions for random draws.","message":"Random sampling is not supported yet. Calling `dist.sample()` raises NotImplementedError. Samples must be drawn using external sampling methods (e.g., MCMC via PyMC).","severity":"gotcha","affected_versions":"<=0.1.3"},{"fix":"Upgrade to Python 3.11 or later.","message":"Support for Python 3.10 and below is dropped. Requires Python >=3.11.","severity":"deprecated","affected_versions":"0.1.0+"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from pytensor_distributions.distributions import Normal' instead.","cause":"Trying to import distribution class directly from top-level package.","error":"ImportError: cannot import name 'Normal' from 'pytensor_distributions'"},{"fix":"Use Normal.dist(mu, sigma) to create a distribution instance.","cause":"Attempting to instantiate distribution with constructor call like Normal(mu, sigma) instead of Normal.dist(mu, sigma).","error":"TypeError: 'Normal' object is not callable"},{"fix":"Do not use .sample(); use external sampling libraries like PyMC for random draws.","cause":"Calling .sample() on a distribution instance.","error":"NotImplementedError: Sampling not implemented"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}