Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e5e1d03
feat: Add Windows pip installation support
visheshrwl Dec 27, 2025
f7aeaab
fix: Use single-line Python test in Windows workflow
visheshrwl Dec 27, 2025
7e811cd
feat: Add Python 3.14 support to Windows builds
visheshrwl Dec 27, 2025
371cf0e
fix: Build cp313 wheel on macOS-15 runner to match test Python version
visheshrwl Dec 27, 2025
c6f8538
fix: Add Windows-specific CMake build configuration to setup.py
visheshrwl Dec 27, 2025
e73327f
fix: Clone json without --depth to allow checkout of specific commit
visheshrwl Dec 27, 2025
1a31344
ci: Add 90-minute timeout to Windows builds
visheshrwl Dec 27, 2025
e12d3b5
fix: Use PowerShell for Windows wheel install and add build validation
visheshrwl Dec 27, 2025
d216800
revert: Match upstream by only building cp314 on macos-15
visheshrwl Dec 27, 2025
01b065b
fix: Skip full tests on macOS Python 3.13 (only cp314 wheel built)
visheshrwl Dec 27, 2025
6f68bf1
fix: Support both x86_64 and aarch64 Linux wheels in test script
visheshrwl Dec 27, 2025
8d53d20
refactor: Consolidate Windows installation docs and cleanup
visheshrwl Jan 3, 2026
7a343df
fix: Address code review feedback
visheshrwl Jan 5, 2026
5a219e2
feat: Add Windows pip installation support
visheshrwl Dec 27, 2025
9a5885f
fix: Build cp313 wheel on macOS-15 runner to match test Python version
visheshrwl Dec 27, 2025
b5f5ca5
revert: Match upstream by only building cp314 on macos-15
visheshrwl Dec 27, 2025
11aeaa0
docs: Update Windows documentation to require Python 3.11+
visheshrwl Jan 13, 2026
3b7e2a4
fix: correct mutex lock initialization in Game class
visheshrwl Jan 13, 2026
aa8199e
fix: update mutex lock initialization in Game class
visheshrwl Jan 13, 2026
8124d65
fix: update basic mode dependency installation in test_wheel.sh to in…
visheshrwl Jan 13, 2026
74336b9
fix: adjust scipy installation for ARM64 in basic mode of test_wheel.sh
visheshrwl Jan 13, 2026
21139a2
fix: update CIBW_BEFORE_ALL_LINUX to install epel-release before open…
visheshrwl Jan 13, 2026
d2761c0
fix: temporarily disable ARM64 build due to scipy compatibility issues
visheshrwl Jan 13, 2026
1435f2e
fix: simplify basic mode dependency installation in test_wheel.sh
visheshrwl Jan 13, 2026
c5f7ef3
fix: update GitHub Actions workflows for Windows support and improve …
visheshrwl Jan 19, 2026
f1c92a3
Merge branch 'google-deepmind:master' into windows-pip-support
visheshrwl Feb 6, 2026
f8ecb46
Merge branch 'google-deepmind:master' into windows-pip-support
visheshrwl Mar 19, 2026
a2fd0e2
chore: reconcile local changes (rename/move) for Windows pip support
visheshrwl Mar 19, 2026
aebd8c1
Merge remote-tracking branch 'upstream/master' into windows-pip-support
visheshrwl Mar 19, 2026
0635cf3
feat: improve cross-platform build for Python wheels and add robust e…
visheshrwl Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/build-wheels-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build Wheels (Windows)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename this file to build-wheels-windows.yml?


on:
push:
branches: [ master, main ]
tags: [ 'v*' ]
pull_request:
branches: [ master, main ]
workflow_dispatch:

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
matrix:
os: [windows-latest]
python-version: ['3.11', '3.12', '3.13', '3.14']

steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install CMake (Windows)
run: |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
refreshenv

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build wheel setuptools

- name: Clone dependencies
run: |
git clone --single-branch --depth 1 https://github.com/pybind/pybind11.git pybind11
git clone -b 20250814.1 --single-branch --depth 1 https://github.com/abseil/abseil-cpp.git open_spiel/abseil-cpp
git clone -b master https://github.com/nlohmann/json.git open_spiel/json
cd open_spiel/json && git checkout 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 && cd ../..
git clone -b master https://github.com/pybind/pybind11_json.git open_spiel/pybind11_json
cd open_spiel/pybind11_json && git checkout d0bf434be9d287d73a963ff28745542daf02c08f && cd ../..
git clone -b master https://github.com/pybind/pybind11_abseil.git open_spiel/pybind11_abseil
cd open_spiel/pybind11_abseil && git checkout 73992b5 && cd ../..
git clone -b develop --single-branch --depth 1 https://github.com/jblespiau/dds.git open_spiel/games/bridge/double_dummy_solver

- name: Build wheel
run: |
python -m build --wheel --outdir dist/
if (!(Test-Path dist/*.whl)) { Write-Error "No wheel file generated"; exit 1 }
Get-ChildItem dist/*.whl
shell: pwsh

- name: Test wheel installation
run: |
$wheel = Get-ChildItem dist/*.whl | Select-Object -First 1
python -m pip install $wheel.FullName
python -c "import pyspiel; game = pyspiel.load_game('tic_tac_toe'); print('OpenSpiel works! Game:', game.get_type().short_name)"
shell: pwsh

- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist/*.whl

upload_pypi:
needs: [build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v6
with:
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/*/
87 changes: 81 additions & 6 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Builds and tests the OpenSpiel wheels using cibuildwheel.
#
# Each wheel is built via the manylinux2014 pypa Docker image on Linux and
# standard MacOS X on 10.15. Each binary wheel is built only for x86_64. Basic
# API tests are run within the Docker environment that built the wheel. Full
# tests (tests that use extra dependencies such as PyTorch, JAX, Tensorflow)
# are tested in the Github Actions CI environment (Ubuntu 20.04 and Mac OS
# 10.15).
# Each wheel is built via the manylinux_2_28 pypa Docker image on Linux,
# standard MacOS X, and Windows using MSVC. Each binary wheel is built for
# x86_64 (and arm64 where supported). Basic API tests are run within the build
# environment. Full tests (tests that use extra dependencies such as PyTorch,
# JAX, Tensorflow) are tested in the Github Actions CI environment.
name: wheels

on:
Expand Down Expand Up @@ -145,3 +144,79 @@ jobs:
dist/*.tar.gz
./wheelhouse/*.whl

# Windows wheel builds - separate job due to different build process (no cibuildwheel)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? no cibuildwheel? I'm surprised, it said it supported Windows.

Fine with me, though, if this works..

build_windows_wheels:
name: Build wheels on Windows Python ${{ matrix.python-version }}
runs-on: windows-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12', '3.13', '3.14']

env:
OPEN_SPIEL_BUILDING_WHEEL: ON

steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install CMake
run: |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
refreshenv
shell: pwsh

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build wheel setuptools
shell: pwsh

- name: Clone dependencies
run: |
git clone --single-branch --depth 1 https://github.com/pybind/pybind11.git pybind11
git clone -b 20250814.1 --single-branch --depth 1 https://github.com/abseil/abseil-cpp.git open_spiel/abseil-cpp
git clone -b master https://github.com/nlohmann/json.git open_spiel/json
cd open_spiel/json && git checkout 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 && cd ../..
git clone -b master https://github.com/pybind/pybind11_json.git open_spiel/pybind11_json
cd open_spiel/pybind11_json && git checkout d0bf434be9d287d73a963ff28745542daf02c08f && cd ../..
git clone -b master https://github.com/pybind/pybind11_abseil.git open_spiel/pybind11_abseil
cd open_spiel/pybind11_abseil && git checkout 73992b5 && cd ../..
git clone -b develop --single-branch --depth 1 https://github.com/jblespiau/dds.git open_spiel/games/bridge/double_dummy_solver
shell: pwsh

- name: Build wheel
run: |
python -m build --wheel --outdir dist/
if (!(Test-Path dist/*.whl)) { Write-Error "No wheel file generated"; exit 1 }
Get-ChildItem dist/*.whl
shell: pwsh

- name: Test wheel installation
run: |
$wheel = Get-ChildItem dist/*.whl | Select-Object -First 1
python -m pip install $wheel.FullName
python -c "import pyspiel; game = pyspiel.load_game('tic_tac_toe'); print('OpenSpiel works! Game:', game.get_type().short_name)"
shell: pwsh

# Note: Windows tests are currently less thorough than Linux/macOS tests.
# TODO: Improve Windows test coverage in future iterations.
- name: Run basic tests
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a commet here that the windows tests are less thorough. Maybe we can improve this down the road.

run: |
python -c "import pyspiel; print('Registered games:', len(pyspiel.registered_names()))"
python -c "import pyspiel; g = pyspiel.load_game('kuhn_poker'); print('Kuhn poker loaded successfully')"
python -c "import pyspiel; g = pyspiel.load_game('leduc_poker'); print('Leduc poker loaded successfully')"
shell: pwsh

- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: wheels-windows-py${{ matrix.python-version }}
path: dist/*.whl
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ To try OpenSpiel in Google Colaboratory, please refer to `open_spiel/colabs` sub
Please choose among the following options:

* [Installing OpenSpiel](docs/install.md)
* [Windows Installation](docs/windows.md)
* [Introduction to OpenSpiel](docs/intro.md)
* [API Overview and First Example](docs/concepts.md)
* [API Reference](docs/api_reference.md)
Expand Down
10 changes: 10 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
OpenSpiel: A Framework for Reinforcement Learning in Games.

OpenSpiel is a collection of environments and algorithms for research in general
reinforcement learning and search/planning in games.
"""

import pyspiel

__all__ = ["pyspiel"]
105 changes: 92 additions & 13 deletions docs/windows.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,97 @@
# OpenSpiel Installation on Windows

OpenSpiel has limited support on Windows and is not being regularly tested,
which means support could break at any time. This may change in the future, but
for now please be aware that Windows support is experimental. Please report any
bugs or problems you encounter.
OpenSpiel now has official support for Windows with pre-built binary wheels
available on PyPI. Windows wheels are built and tested automatically via GitHub
Actions CI for Python 3.11, 3.12, and 3.13.

OpenSpiel has limited support on Windows and is not being regularly tested,
which means support could break at any time. This may change in the future
(contributions are welcome), with Github Actions supporting
[windows workers](https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners#installing-software-on-windows-runners!),
but for now please be aware that Windows support is experimental. Please report
any bugs or problems you encounter.
> **Note:** Windows support is currently experimental. If you encounter any
> issues, please [open an issue](https://github.com/deepmind/open_spiel/issues)
> on GitHub so we can improve the Windows experience.

## Option 1: Windows Installation using Visual Studio Community Edition
## Option 1: Quick Installation using pip (Recommended)

The easiest way to install OpenSpiel on Windows is using pip:

```bash
pip install open-spiel
```

### Optional dependencies
For additional features like visualization and machine learning:
```bash
pip install open-spiel[full]
```

### Verification

Test your installation:
```python
import pyspiel

# Create a simple game
game = pyspiel.load_game("tic_tac_toe")
state = game.new_initial_state()
print("OpenSpiel is working!")
```

### Building from Source

If you need to build from source or contribute to the project:

#### Prerequisites
- **Python 3.11+** (get from [python.org](https://python.org))
- **Git** (get from [git-scm.com](https://git-scm.com))
- **CMake 3.15+** (get from [cmake.org](https://cmake.org))
- **Visual Studio 2019 or later** with C++ development tools

#### Build Steps
1. Clone the repository:
```bash
git clone https://github.com/deepmind/open_spiel.git
cd open_spiel
```

2. Build the wheel:
```bash
python -m pip wheel . --no-deps -w dist
```

3. Install the built wheel:
```bash
pip install dist/open_spiel-*.whl
```

### Troubleshooting

**"CMake not found"**
- Install CMake from [cmake.org](https://cmake.org) and add it to your PATH

**"Git not found"**
- Install Git from [git-scm.com](https://git-scm.com) and add it to your PATH

**"MSVC compiler not found"**
- Install Visual Studio Community with C++ development tools
- Or install "Microsoft C++ Build Tools"

**"Import pyspiel failed"**
- Make sure you installed the package: `pip install open-spiel`
- Try reinstalling: `pip uninstall open-spiel && pip install open-spiel`

### Development Installation
```bash
git clone https://github.com/deepmind/open_spiel.git
cd open_spiel
pip install -e .
```

### Using with Conda
```bash
conda create -n openspiel python=3.11
conda activate openspiel
pip install open-spiel
```

## Option 2: Windows Installation using Visual Studio Community Edition

This option will describe how to install and use OpenSpiel on Windows 10 via
[Visual Studio Community Edition](https://visualstudio.microsoft.com/vs/community/).
Expand All @@ -28,7 +107,7 @@ You will need to have the following dependencies installed:
* [CMake](https://cmake.org/download/)
* [git](https://gitforwindows.org/)
* [Python](https://www.python.org/downloads/windows/). Note: get the latest
3.9 release as OpenSpiel has not been tested on 3.10 yet. Also, tick the box
3.11 or newer release. Tick the box
during installation to ensure Python executable is in your path.
* Recommended: Windows Terminal / Powershell.

Expand Down Expand Up @@ -85,7 +164,7 @@ pip install numpy
For a complete list, depending on what you will use, see
[python_extra_deps.sh](https://github.com/deepmind/open_spiel/blob/master/open_spiel/scripts/python_extra_deps.sh).

## Option 2: Windows Installation using Windows Subsystem for Linux (WSL)
## Option 3: Windows Installation using Windows Subsystem for Linux (WSL)

This section describes the installation steps to get OpenSpiel running in a
Windows 10 environment using Windows Subsystem for Linux (WSL). Note that WSL
Expand Down
3 changes: 2 additions & 1 deletion open_spiel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ include_directories (pybind11_json/include)
add_library(open_spiel_core OBJECT ${OPEN_SPIEL_CORE_FILES})
target_include_directories (
open_spiel_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} abseil-cpp)
link_libraries(open_spiel_core
target_link_libraries(open_spiel_core
absl::algorithm
absl::flags
absl::flags_parse
Expand All @@ -218,6 +218,7 @@ link_libraries(open_spiel_core
absl::time
)


# Just the minimal base library: no games.
set (OPEN_SPIEL_CORE_OBJECTS $<TARGET_OBJECTS:open_spiel_core>)

Expand Down
2 changes: 1 addition & 1 deletion open_spiel/games/crazy_eights/crazy_eights.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void CrazyEightsState::WriteObservationTensor(Player player,
SPIEL_CHECK_GE(player, 0);
SPIEL_CHECK_LT(player, num_players_);

absl::c_fill(values, 0.);
absl::c_fill(values, 0.0f);
if (phase_ == Phase::kDeal) return;

for (int card = 0; card < kNumCards; ++card) {
Expand Down
2 changes: 1 addition & 1 deletion open_spiel/games/dou_dizhu/dou_dizhu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void DouDizhuState::WriteObservationTensor(Player player,
SPIEL_CHECK_GE(player, 0);
SPIEL_CHECK_LT(player, num_players_);

absl::c_fill(values, 0.);
absl::c_fill(values, 0.0f);
if (phase_ == Phase::kDeal) return;
auto values_iterator = values.begin();
const int played_deck_base = (kNumRanks - 2) * (kNumSuits + 1) + 2 * 2;
Expand Down
3 changes: 3 additions & 0 deletions open_spiel/games/lines_of_action/lines_of_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ Player CellStateToPlayer(CellState cell_state) {
return 0;
case CellState::kWhite:
return 1;
default:
return kInvalidPlayer;
}
}


CellState PlayerToCellState(Player player) {
switch (player) {
case 0:
Expand Down
1 change: 1 addition & 0 deletions open_spiel/games/tarok/contracts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ std::string ContractNameToString(const ContractName& contract_name) {
case ContractName::kNotSelected:
return "Not selected";
}
SpielFatalError("Unknown contract name");
}

} // namespace tarok
Expand Down
Loading
Loading