Install#
PythTB can be installed in a variety of ways depending on your workflow. This page covers system requirements, quick installation methods, and optional developer setups.
Dependencies#
PythTB follows the SPEC-0 support window for scientific Python packages.
Required dependencies:
Python ≥ 3.12
NumPy ≥ 2.0
Matplotlib ≥ 3.9
Optional extras (install via pip install .[$GROUP]):
[plotting]: plotly (interactive 3D plots)[speedup]: tensorflow[notebooks]: ipython ≥ 8.17, ipykernel, notebook ≥ 7.0, jupyter, jupyterlab[docs]: sphinx toolchain for building documentation[tests]: pytest[dev]: pytest, black, ruff, pre-commit, nbstripout
Check your Python version by running:
python -V
If you need to upgrade Python, see Installing or Upgrading Python below. If you are new to Python see our resources.
Quick Installation#
Install PythTB from PyPI or conda-forge.
# Using pip
pip install pythtb --upgrade
# Using conda
conda install -c conda-forge pythtb
Verify installation:
python -c "import pythtb; print(pythtb.__version__)"
If you encounter issues, see Troubleshooting.
Installing from Source#
Installing from source is recommended for contributors or for using the latest development version.
Create a virtual environment using
conda(recommended):
conda create -n pythtb-dev python=3.12
conda activate pythtb-dev
Clone the repository:
git clone https://github.com/pythtb/pythtb.git
cd pythtb
Install the package along with any optional dependencies you need:
pip install . # or pip install .[$GROUP] for optional dependencies
For an editable install,
pip install -e .
Editable installs allow immediate reflection of code changes. If you modify the source code, those changes will immediately take effect in your local environment. If you don’t see updates reflected, restart the interpreter or Jupyter kernel.
For more details about setting up your development environment, see the Developer Installation Wiki.
Older Versions#
The latest stable release is always available on PyPI and conda-forge.
Install a specific version using conda:
conda install -c conda-forge pythtb=X.Y.Z
Note
Currently only PythTB >= 1.8.0 are available on Conda-Forge.
Using pip, you can install all older versions from PyPI:
pip install pythtb==X.Y.Z
Check the installed version with:
pip show pythtb
The source code of all previous releases of PythTB can be downloaded below in Version List.
Verify installation#
After installation, verify by running:
import pythtb
print(pythtb.__version__)
This should print the installed version of PythTB without errors.
Installing or Upgrading Python#
If you don’t already have Python 3.12 or higher, follow one of the options below.
Anaconda / Miniconda (Recommended)#
Miniconda provides a lightweight version of Anaconda, ideal for managing clean environments for scientific packages like PythTB.
If you prefer to manage environments separately, install Python via Miniconda:
conda create -n pythtb-env python=3.12
conda activate pythtb-env
macOS and Linux#
Use your system’s package manager:
# Ubuntu / Debian
sudo apt-get install python3
# macOS (via Homebrew)
brew install python
Alternatively, download the latest release from the official Python website.
Windows#
Download and run the official installer from python.org. Make sure to check “Add Python to PATH” during installation.
Troubleshooting#
Common issues and fixes:
ModuleNotFoundErrorMake sure you are using the correct Python environment where PythTB is installed. If using
conda, activate the environment:conda activate your-env-name
Check installation with:
conda list | grep pythtb
Conflicting installations
If you have multiple installations of PythTB, uninstall them first:
pip uninstall pythtb conda remove pythtb
Then reinstall using one method (pip or conda).
Conflicts between pip and conda
Avoid mixing
pipandcondainstallations in the same environment. Prefer using one package manager consistently. The exception is usingpipto install packages not available viacondaor when installing in editable mode.Editable mode issues
If you installed PythTB in editable mode and changes are not reflected, restart your Python interpreter or Jupyter kernel. Make sure you installed with the
-eflag:pip install -e .
If problems persist, open an issue on the GitHub repository.
Version List#
See changelog for a complete list of changes.
Version 2.0.0 (current)#
11 November 2025: pythtb-2.0.0.tar.gz
Version 1.8.0#
20 September 2022: pythtb-1.8.0.tar.gz
Version 1.7.2#
1 August 2017: pythtb-1.7.2.tar.gz
Version 1.7.1#
22 December 2016: pythtb-1.7.1.tar.gz
Version 1.7.0#
7 June 2016: pythtb-1.7.0.tar.gz
Version 1.6.2#
25 February 2013: pythtb-1.6.2.tar.gz
Version 1.6.1#
15 November 2012: pythtb-1.6.1.tar.gz
Version 1.5#
4 June 2012: pytb-1.5.tar.gz