Registry / data / latex2sympy2-extended

latex2sympy2-extended

JSON →
library1.11.0pypypi✓ verified 23d ago

latex2sympy2-extended parses LaTeX math expressions and converts them into equivalent SymPy forms. It supports a wide range of mathematical constructs including arithmetic, common functions, calculus, and linear algebra. The current version is 1.11.0, with a release cadence reflecting active development and maintenance.

pip install latex2sympy2-extended
INSTALL
IMPORT
SIG · LATEX2SYMPY2-EXTEN
L
latex2sympy2-extended
datapythonv1.11.0
Install
6.3s avg
Import
1164ms
Disk
95MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.11.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
musl
glibc
py 3.10
✓ —
✓ 5.8s
py 3.11
✓ —
✓ 6s
py 3.12
✓ —
✓ 6.7s
py 3.13
✓ —
✓ 6.8s
py 3.9
✕ build_error
✕ build_error
95MB installed
● package 95MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

latex2sympy
from latex2sympy2_extended import latex2sympy
from latex2sympy2 import latex2sympy
Ensure you import from 'latex2sympy2_extended' and not the older 'latex2sympy2' or 'latex2sympy' packages.

This quickstart demonstrates how to import the `latex2sympy` function and use it to convert a common LaTeX derivative expression into its SymPy equivalent.

from latex2sympy2_extended import latex2sympy # Define a LaTeX expression for a derivative tex_expression = r"\frac{d}{dx}(x^{2}+x)" # Convert the LaTeX expression to a SymPy expression sympy_expression = latex2sympy(tex_expression) print(sympy_expression) # Expected output: Derivative(x**2 + x, x)
Debug
Known issues
breakingThe library is not compatible with Python 3.13 due to the removal of 'typing.io'. It requires Python 3.12 or below.
fix
Use Python 3.12 or an earlier version until compatibility is officially added.
affects: All versions with Python 3.13+
deprecatedThe `latex2sympy2_extended.math_normalization.equations` module/functionality is deprecated as its handling is now integrated directly into the parser.
fix
Remove direct calls to `math_normalization.equations` and rely on the parser's built-in handling.
affects: Versions 1.0.9 and later (as reported in Feb 2025)
gotchaWhen converting certain linear algebra expressions (e.g., determinants, transposed matrices, elementary transformations), the conversion process may involve irreversible calculations, meaning the resulting SymPy expression might not be algebraically identical to the original if interpreted purely symbolically.
fix
Be aware of this limitation and verify results for complex linear algebra operations.
affects: All versions
gotchaComma-separated numbers are only supported in standalone forms (e.g., '1,233') and not within expressions (e.g., '1,233x').
fix
Ensure that comma-separated numbers are used as standalone values or reformatted before passing to the parser if they are part of a larger expression.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'typing.io'
The `latex2sympy2-extended` library, or its `antlr4-python3-runtime` dependency, is not compatible with Python 3.13 because the `typing.io` module was removed in that Python version.
fix
Use Python 3.12 or an earlier version.
from latex2sympy2 import latex2sympy
Users attempting to use `latex2sympy2-extended` might mistakenly import from the older `latex2sympy2` package.
fix
Change the import statement to `from latex2sympy2_extended import latex2sympy`.
pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. latex2sympy2-extended X.Y.Z requires antlr4-python3-runtime==A.B.C, but you have antlr4-python3-runtime D.E.F which is incompatible.
There is a version conflict with the `antlr4-python3-runtime` dependency, often because other installed packages require a different version.
fix
Install `latex2sympy2-extended` specifying a compatible ANTLR4 runtime version, for example, `pip install latex2sympy2_extended[antlr4_13_2]`.
WARNING - latex2sympy2_extended.math_normalization - equations is deprecated, as it handled by the parser now
The `latex2sympy2_extended.math_normalization.equations` module/functionality is deprecated because its handling is now integrated directly into the parser.
fix
Remove direct calls to `math_normalization.equations` and rely on the parser's built-in handling.
ModuleNotFoundError: No module named 'latex2sympy2_extended'
The 'latex2sympy2-extended' library is not installed in your current Python environment.
fix
pip install latex2sympy2-extended
Upgrade
Version history
1.11.0latest on PyPI · released Jan 10, 2026
Audit
Dependencies
sympyrequiredCore dependency for symbolic mathematics.
antlr4-python3-runtimerequiredUsed for parsing LaTeX expressions, specific runtime versions (e.g., 4.9.3, 4.11.0, 4.13.2) can be specified during installation.
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
latex2sympy2-extended — pip install latex2sympy2-extended · libregistry