Install & Compatibility
Where this runs
tested against v1.6.11 · 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.910 runs
build_error
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 9.2s · import 0.019s · 253MB
279MB installed
● package 279MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
pyspiel
✓ import pyspiel
✗ import open_spiel
The core Python interface is exposed via the 'pyspiel' module, not 'open_spiel'.
load_game
✓ game = pyspiel.load_game('tic_tac_toe')
✗ game = pyspiel.tic_tac_toe()
Games are loaded by string name using `pyspiel.load_game()`, not accessed directly as functions.
This quickstart demonstrates how to load a game, create an initial state, apply an action, and check the game's status using the core `pyspiel` module.
import pyspiel
# Load a game by its string identifier
game = pyspiel.load_game("tic_tac_toe")
# Create a new initial state for the game
state = game.new_initial_state()
# Print the initial state
print("Initial state:\n", state)
# Apply a move (e.g., player 0 places 'X' in the center)
# Actions are integer indices, you can get valid actions via state.legal_actions()
state.apply_action(4) # Assuming 4 is a valid action in Tic-Tac-Toe
print("\nState after move:\n", state)
# Check if the game is terminal
if state.is_terminal():
print("\nGame is over. Returns:", state.returns())
Debug
Known issues
breakingOpenSpiel is currently in a 'staging' phase for version 2.0. Significant breaking changes are expected in the upcoming 2.0 release, for which a full changelog will be made available. Users should be prepared for API shifts.fixMonitor official OpenSpiel GitHub releases and documentation for 2.0 migration guides. Pin your dependency to 1.x if stability is critical.
affects: 1.x (impending 2.0)
breakingSupport for Python 3.9 was dropped in version 1.6.4. The current version (1.6.12) requires Python 3.11 or newer.fixEnsure your environment uses Python 3.11 or later. Upgrade your Python installation or use a virtual environment with a supported Python version.
affects: >=1.6.4
gotchaOpenSpiel is a C++ library with Python bindings. While `pip install` usually provides pre-built wheels, building from source (e.g., for custom modifications or specific platforms) can be complex and requires a C++ compiler, CMake, and other development tools.fixFor standard usage, prefer `pip install open-spiel`. If custom compilation is required, follow the detailed instructions in the official documentation, ensuring all build dependencies are met.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyspiel'
The `open-spiel` package, or its `pyspiel` sub-module, is not installed or not accessible in the current Python environment.
fixEnsure you have successfully installed OpenSpiel using `pip install open-spiel` and that your environment is correctly activated.
RuntimeError: OpenSpiel requires Python version >= 3.11, but found X.Y.
You are attempting to use OpenSpiel with an unsupported Python version (older than 3.11).
fixUpgrade your Python installation to version 3.11 or later, or use a virtual environment configured with a supported Python version.
TypeError: load_game() missing 1 required positional argument: 'game_string'
The `pyspiel.load_game()` function expects a string argument representing the name of the game to load (e.g., 'tic_tac_toe').
fixCall `pyspiel.load_game()` with the game's identifier as a string, for example: `game = pyspiel.load_game('tic_tac_toe')`. Upgrade
Version history
1.6.15latest on PyPI · released May 22, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.11 or higher.