Skip to content

Commit

Permalink
Merge pull request google-deepmind#572 from deepmind:lanctot_py3.9
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 372109726
Change-Id: I0129102e567d1dea6da1f13294a21d3f7afa2cf9
  • Loading branch information
open_spiel@google.com authored and open_spiel@google.com committed May 10, 2021
2 parents dcd00c6 + e5c2dc7 commit 2322ebb
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 35 deletions.
49 changes: 20 additions & 29 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,49 @@ jobs:
strategy:
matrix:
include:
# Build and run tests without all optional dependencies (default behavior)
# Ubuntu 18.04.2 LTS released on 26 April 2018
- os: ubuntu-18.04
OS_PYTHON_VERSION: 3.6
# Standard platforms with Python 3.9.
- os: ubuntu-20.04
OS_PYTHON_VERSION: 3.9
TRAVIS_USE_NOX: 0
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
- os: "ubuntu-20.04"
OS_PYTHON_VERSION: 3.8
- os: macos-10.15
OS_PYTHON_VERSION: 3.9
TRAVIS_USE_NOX: 0
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
# Build and run tests with all optional dependencies, including building a
# shared library with linkable third party dependencies in place.
# Standard platforms with Python 3.8.
- os: ubuntu-20.04
DEFAULT_OPTIONAL_DEPENDENCY: "ON"
TRAVIS_USE_NOX: 0
BUILD_SHARED_LIB: "ON"
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "ON"
OPEN_SPIEL_BUILD_WITH_ORTOOLS_DOWNLOAD_URL: "https://github.com/google/or-tools/releases/download/v8.0/or-tools_ubuntu-20.04_v8.0.8283.tar.gz"
# macOS Catalina 10.15
- os: macos-10.15
OS_PYTHON_VERSION: 3.7
OS_PYTHON_VERSION: 3.8
TRAVIS_USE_NOX: 0
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
## Tests using PIP
# Build and run tests without all optional dependencies (default behavior) and
# use nox
- os: ubuntu-20.04
- os: macos-10.15
OS_PYTHON_VERSION: 3.8
TRAVIS_USE_NOX: 1
TRAVIS_USE_NOX: 0
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
# Build and run tests with all optional dependencies, including building a
# shared library with linkable third party dependencies in place.
- os: ubuntu-20.04
OS_PYTHON_VERSION: 3.9
DEFAULT_OPTIONAL_DEPENDENCY: "ON"
TRAVIS_USE_NOX: 0
BUILD_SHARED_LIB: "ON"
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "ON"
OPEN_SPIEL_BUILD_WITH_ORTOOLS_DOWNLOAD_URL: "https://github.com/google/or-tools/releases/download/v8.0/or-tools_ubuntu-20.04_v8.0.8283.tar.gz"
# Ubuntu 18.04.2 LTS released on 26 April 2018.
- os: ubuntu-18.04
OS_PYTHON_VERSION: 3.6
TRAVIS_USE_NOX: 1
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
- os: "macos-10.15"
OS_PYTHON_VERSION: 3.7
TRAVIS_USE_NOX: 1
TRAVIS_USE_NOX: 0
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "OFF"
Expand Down
7 changes: 6 additions & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
If you plan to only use the Python API, then the easiest way to install
OpenSpiel is to use pip. As only source distribution is currently supported,
CMake, Clang and Python 3 development files are required to build the Python
extension.
extension. Note that we recommend Clang but g++ >= 9.2 should also work.

E.g. on Ubuntu or Debian:

Expand Down Expand Up @@ -57,6 +57,11 @@ Ubuntu 20.04 (or 19.10), Debian 10, or later versions. There are
compilers on Ubuntu on 18.04, and `clang-10` must be installed separately. On
MacOS, we recommend XCode 11 or newer.

For the Python API: our tests run using Python 3.8 and 3.9 on Ubuntu 20.04 and
MacOS 10.15. We also test using Ubuntu 18.04 LTS with Python 3.6. So, we
recommend one of these setups. If you encounter any problems on other setups,
please let us know by opening an issue.

Currently there are two installation methods:

1. building from the source code and editing `PYTHONPATH`.
Expand Down
4 changes: 2 additions & 2 deletions open_spiel/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then # Mac OSX
[[ -x `which cmake` ]] || brew install cmake || echo "** Warning: failed 'brew install cmake' -- continuing"
[[ -x `which python3` ]] || brew install python3 || echo "** Warning: failed 'brew install python3' -- continuing"
# On Github Actions, macOS 10.15 comes with Python 3.9.
# Only 3.8 is supported by Tensorflow 2.2, and only 3.7 currently runs on CI.
if [[ "$CI" ]]; then
# We want to test multiple Python versions determined by OS_PYTHON_VERSION.
if [[ "$CI" && "${OS_PYTHON_VERSION}" != "3.9" ]]; then
brew install "python@${OS_PYTHON_VERSION}"
brew unlink python@3.9
brew link --force --overwrite "python@${OS_PYTHON_VERSION}"
Expand Down
6 changes: 3 additions & 3 deletions open_spiel/scripts/python_extra_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
# To enable specific tests, please use the environment variables found in
# scripts/global_variables.sh
export OPEN_SPIEL_PYTHON_JAX_DEPS="jax==0.2.7 jaxlib==0.1.57 dm-haiku==0.0.3 optax==0.0.2 chex==0.0.3"
export OPEN_SPIEL_PYTHON_PYTORCH_DEPS="torch==1.7.0"
export OPEN_SPIEL_PYTHON_TENSORFLOW_DEPS="tensorflow==2.4.1 tensorflow-probability<0.8.0,>=0.7.0"
export OPEN_SPIEL_PYTHON_MISC_DEPS="IPython==5.8.0 cvxopt==1.2.5 networkx==2.4 matplotlib==3.2.2 mock==4.0.2 nashpy==0.0.19 scipy==1.4.1 testresources==2.0.1"
export OPEN_SPIEL_PYTHON_PYTORCH_DEPS="torch==1.8.1"
export OPEN_SPIEL_PYTHON_TENSORFLOW_DEPS="tensorflow==2.5.0rc2 tensorflow-probability<0.8.0,>=0.7.0"
export OPEN_SPIEL_PYTHON_MISC_DEPS="IPython==5.8.0 cvxopt==1.2.5 networkx==2.4 matplotlib==3.2.2 mock==4.0.2 nashpy==0.0.19 scipy==1.5.4 testresources==2.0.1"
9 changes: 9 additions & 0 deletions open_spiel/scripts/travis_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
set -e
set -x

# Python 3.9 not default on Ubuntu yet.
OS=`uname -a | awk '{print $1}'`
if [[ "$OS" = "Linux" && "$OS_PYTHON_VERSION" = "3.9" ]]; then
echo "Linux detected and Python 3.9 requested. Installing Python 3.9 and setting as default."
sudo apt-get install python3.9 python3.9-dev
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
fi

source ./open_spiel/scripts/python_extra_deps.sh

sudo -H pip3 install --upgrade pip
Expand Down

0 comments on commit 2322ebb

Please sign in to comment.