Install & Compatibility
Where this runs
tested against v3.10.1 · 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
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 8.0s · import 0.376s · 146MB
157MB installed
● package 157MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
tables
✓ import tables
The primary module for PyTables.
open_file
✓ tables.open_file
✗ tables.openFile
As of PyTables 3.10.0, the `open_file` function (snake_case) is the preferred method for opening HDF5 files, aligning with Python style guides. `openFile` (camelCase) is still supported but discouraged.
IsDescription
✓ tables.IsDescription
Base class for defining the structure (description) of tables.
This quickstart demonstrates how to create an HDF5 file, define a table structure using `IsDescription`, create a table, append data, and read data using PyTables. It also shows the importance of using context managers (`with`) for file handling to ensure proper closing.
import tables as tb
import numpy as np
import os
# Define a table description
class MyTableDescription(tb.IsDescription):
col1 = tb.StringCol(16, pos=1)
col2 = tb.Int32Col(pos=2)
col3 = tb.Float64Col(pos=3)
filename = "mytable.h5"
if os.path.exists(filename):
os.remove(filename)
try:
# Open the HDF5 file in write mode
with tb.open_file(filename, mode="w", title="Test File") as h5f:
# Create a group for organization
group = h5f.create_group(h5f.root, "data")
# Create a table within the group
table = h5f.create_table(group, 'table1', MyTableDescription, "My First Table")
# Append data to the table
table.append([("row_a", 1, 1.1), ("row_b", 2, 2.2)])
table.flush() # Ensure data is written to disk
print("\nData in table1 after first append:")
for row in table.iterrows():
print(f" col1: {row['col1']}, col2: {row['col2']}, col3: {row['col3']}")
# Add more data
table.append([("row_c", 3, 3.3), ("row_d", 4, 4.4)])
table.flush()
print("\nAll data in table1 (as NumPy record array):")
print(table[:]) # Read all data into a NumPy record array
print(f"\nSuccessfully created and written to {filename}")
# Re-open the file in read mode to verify
with tb.open_file(filename, mode="r") as h5f_read:
read_table = h5f_read.root.data.table1
print("\nData read from file:")
for row in read_table.iterrows():
print(f" col1: {row['col1']}, col2: {row['col2']}, col3: {row['col3']}")
except Exception as e:
print(f"An error occurred: {e}")
finally:
# Clean up the created file
if os.path.exists(filename):
os.remove(filename)
print(f"Cleaned up {filename}")
ptdump --version
Errors
Common errors & fixes
fatal error: hdf5.h: No such file or directory
PyTables requires the HDF5 C library development headers to be installed on your system for successful compilation during `pip install`.
fixInstall the HDF5 development package for your OS: `sudo apt-get install libhdf5-dev` (Debian/Ubuntu), `sudo yum install hdf5-devel` (CentOS/RHEL), or `brew install hdf5` (macOS) before running `pip install tables`.
ModuleNotFoundError: No module named 'tables'
The `tables` library or its dependencies were not installed successfully or are not accessible in the current Python environment.
fixInstall the library using pip: `pip install tables`. If installation fails, address any underlying HDF5 dependency issues first.
IOError: unable to open file (file is not an HDF5 file)
You are attempting to open a file that is either corrupted, empty, or not a valid HDF5 file recognized by PyTables.
fixEnsure the file specified is a properly created HDF5 file; verify its integrity, or create a new one using `tables.open_file()`.
KeyError: 'group path does not exist'
You are trying to access a node (group or array) within the HDF5 file using a path that does not exist in the file's structure.
fixCheck the existing structure of your HDF5 file using `file.walk_nodes()` or `file.root._v_children` to find the correct path.
Upgrade
Version history
3.11.1latest on PyPI · released Mar 1, 2026
Audit
Dependencies
numpyrequiredFundamental for array operations and defining data structures.