How to Install sympy in Python
Computer algebra system (CAS) in Python
pip install sympy
What is sympy?
Computer algebra system (CAS) in Python
See the AUTHORS file for the list of authors.
And many more people helped on the SymPy mailing list, reported bugs, helped organize SymPy's participation in the Google Summer of Code, the Google Highly Open Participation Contest, Google Code-In, wrote and blogged about SymPy...
License: New BSD License (see the LICENSE file for details) covers all files in the sympy repository unless stated otherwise.
Quick Start
Minimal example to get started with sympy:
from sympy import symbols, solve, diff
x = symbols("x")
expr = x**2 - 5*x + 6
print(solve(expr, x)) # [2, 3]
print(diff(expr, x)) # 2*x - 5
Installation
pip (standard)
pip install sympy
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install sympy
pip3
pip3 install sympy
conda
conda install -c conda-forge sympy
Poetry
poetry add sympy
Dependencies
Installing sympy will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import sympy; print(sympy.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing sympy with pip.
ModuleNotFoundError: No module named 'sympy'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install sympy. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'sympy' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install sympy to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'sympy'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show sympy and upgrade with pip install --upgrade sympy.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install sympy. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user sympy
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org sympy
MemoryError when loading data
Cause: Dataset is too large to fit in RAM.
Fix: Read in chunks, filter columns on load, or consider Polars/Dask for out-of-core processing.
Recent Releases
| Version | Released |
|---|---|
1.14.0 latest |
2025-04-27 |
1.14.0rc2 |
2025-04-25 |
1.14.0rc1 |
2025-04-14 |
1.13.3 |
2024-09-18 |
1.13.2 |
2024-08-11 |
Manage sympy
Upgrade to latest version
pip install --upgrade sympy
Install a specific version
pip install sympy==1.14.0
Uninstall
pip uninstall sympy
Check what is installed
pip show sympy