{"id":10006,"library":"open-spiel","title":"OpenSpiel: A Framework for Reinforcement Learning in Games","description":"OpenSpiel is a collection of environments and algorithms for research in reinforcement learning and search in games. It provides implementations of numerous games (e.g., Chess, Go, Poker, Tic-Tac-Toe) and common algorithms (e.g., MCTS, AlphaZero, CFR). The library is currently at version 1.6.12, with frequent staging releases in preparation for a major 2.0 release. It's developed and maintained by Google DeepMind.","status":"active","version":"1.6.12","language":"en","source_language":"en","source_url":"https://github.com/deepmind/open_spiel","tags":["game theory","reinforcement learning","multi-agent","AI","pyspiel","deepmind"],"install":[{"cmd":"pip install open-spiel","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Requires Python 3.11 or higher.","package":"python","optional":false}],"imports":[{"note":"The core Python interface is exposed via the 'pyspiel' module, not 'open_spiel'.","wrong":"import open_spiel","symbol":"pyspiel","correct":"import pyspiel"},{"note":"Games are loaded by string name using `pyspiel.load_game()`, not accessed directly as functions.","wrong":"game = pyspiel.tic_tac_toe()","symbol":"load_game","correct":"game = pyspiel.load_game('tic_tac_toe')"}],"quickstart":{"code":"import pyspiel\n\n# Load a game by its string identifier\ngame = pyspiel.load_game(\"tic_tac_toe\")\n\n# Create a new initial state for the game\nstate = game.new_initial_state()\n\n# Print the initial state\nprint(\"Initial state:\\n\", state)\n\n# Apply a move (e.g., player 0 places 'X' in the center)\n# Actions are integer indices, you can get valid actions via state.legal_actions()\nstate.apply_action(4) # Assuming 4 is a valid action in Tic-Tac-Toe\nprint(\"\\nState after move:\\n\", state)\n\n# Check if the game is terminal\nif state.is_terminal():\n    print(\"\\nGame is over. Returns:\", state.returns())","lang":"python","description":"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."},"warnings":[{"fix":"Monitor official OpenSpiel GitHub releases and documentation for 2.0 migration guides. Pin your dependency to 1.x if stability is critical.","message":"OpenSpiel 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.","severity":"breaking","affected_versions":"1.x (impending 2.0)"},{"fix":"Ensure your environment uses Python 3.11 or later. Upgrade your Python installation or use a virtual environment with a supported Python version.","message":"Support for Python 3.9 was dropped in version 1.6.4. The current version (1.6.12) requires Python 3.11 or newer.","severity":"breaking","affected_versions":">=1.6.4"},{"fix":"For 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.","message":"OpenSpiel 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.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure you have successfully installed OpenSpiel using `pip install open-spiel` and that your environment is correctly activated.","cause":"The `open-spiel` package, or its `pyspiel` sub-module, is not installed or not accessible in the current Python environment.","error":"ModuleNotFoundError: No module named 'pyspiel'"},{"fix":"Upgrade your Python installation to version 3.11 or later, or use a virtual environment configured with a supported Python version.","cause":"You are attempting to use OpenSpiel with an unsupported Python version (older than 3.11).","error":"RuntimeError: OpenSpiel requires Python version >= 3.11, but found X.Y."},{"fix":"Call `pyspiel.load_game()` with the game's identifier as a string, for example: `game = pyspiel.load_game('tic_tac_toe')`.","cause":"The `pyspiel.load_game()` function expects a string argument representing the name of the game to load (e.g., 'tic_tac_toe').","error":"TypeError: load_game() missing 1 required positional argument: 'game_string'"}]}