Repository: google-deepmind/open_spiel (language: python)

Issue:
higc referee_test fails: No module named 'numpy'
When attempting to install latest master open_spiel, I ran into the following failed test:
```
Starting players.
Bot#0: /Users/kevin/github/open_spiel_fork/open_spiel/higc/bots/random_bot_py.sh
Bot#1: /Users/kevin/github/open_spiel_fork/open_spiel/higc/bots/test_bot_start.sh
Bot#0: Traceback (most recent call last):
  File "/Users/kevin/github/open_spiel_fork/open_spiel/higc/bots/random_bot.py", line 19, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
Bot#0 did not respond 'ready'
Bot#0 response was: ''
Bot#0 also timed out.
Bot#1 ready ok.
Could not start all players correctly, cannot play the tournament.
Spiel Fatal Error: /Users/kevin/github/open_spiel_fork/open_spiel/higc/referee_test.cc:131 results->num_matches() == 1
results->num_matches() = 0, 1 = 1
```

I followed the steps
> ./install.sh
> pip3 install -r requirements.txt
> ./open_spiel/scripts/build_and_run_tests.sh

I have numpy installed on the `python` I'm using, as well as my system's python, so I'm not sure why this is happening.

I can disable the test to move forward, but I'm filing this issue here in case anyone else experiences this or knows how to fix it.

cc: @michalsustr 


Discussion / hints:
Hmm, this is indeed puzzling. I am not sure what is going on.

Just making sure following assumptions are true:

1. You are using Mac, according to those paths, is that correct? 
2. You have invoked the python console for either the system or open_spiel venv installation and can import numpy?

My suspicion is that env flags are not properly passed to the forked python subprocess. Can you put following before the import to see if we learn more?

```
import os
print(os.environ, file=sys.stderr)
```

Please post results if you run both `python random_bot.py` directly from the terminal in the `open_spiel/higc/bots/` directory, and by invoking the referee test from the project root directory, with something like
`./build/higc/referee_test --bots_dir=/Users/kevin/github/open_spiel_fork/open_spiel/higc/bots/`

 Thanks!
Instead of pip3 can you try:

```
python -m pip install -r requirements.txt
```
Maybe also check that python and python3 point to the same place? I am curious about whether python runs the random_boy.py directly as suggested by Michal.
Just a quick note to say I have reproduced this problem on my desktop machine (recently upgraded to Ubuntu 21.10)

Edit: in fact, it's not nust random_bot.py either (fail_after_few_actions, illegal_actions, etc.) and referee_test also fails.

Fix patch:
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml
index 41483742e7..5eff627299 100644
--- a/.github/workflows/wheels.yml
+++ b/.github/workflows/wheels.yml
@@ -49,28 +49,27 @@ jobs:
 
     steps:
       - uses: actions/checkout@v2
-      - uses: actions/setup-python@v2
 
       - name: Install
         run: |
           pwd
           uname -a
-          which python
+          # which python
           which g++
           g++ --version
-          python --version
+          # python --version
           chmod +x install.sh
           # This is needed to grab OpenSpiel dependencies.
           ./install.sh
           # These are necessary to install what is necessary for the build and for the full tests below.
-          python -m pip install --upgrade pip
-          python -m pip --version
-          python -m pip install --upgrade setuptools
-          python -m pip install --upgrade -r requirements.txt -q
+          python3 -m pip install --upgrade pip
+          python3 -m pip --version
+          python3 -m pip install --upgrade setuptools
+          python3 -m pip install --upgrade -r requirements.txt -q
           source ./open_spiel/scripts/python_extra_deps.sh
-          python -m pip install --upgrade $OPEN_SPIEL_PYTHON_JAX_DEPS $OPEN_SPIEL_PYTHON_PYTORCH_DEPS $OPEN_SPIEL_PYTHON_TENSORFLOW_DEPS $OPEN_SPIEL_PYTHON_MISC_DEPS
-          python -m pip install twine
-          python -m pip install cibuildwheel==2.0.1
+          python3 -m pip install --upgrade $OPEN_SPIEL_PYTHON_JAX_DEPS $OPEN_SPIEL_PYTHON_PYTORCH_DEPS $OPEN_SPIEL_PYTHON_TENSORFLOW_DEPS $OPEN_SPIEL_PYTHON_MISC_DEPS
+          python3 -m pip install twine
+          python3 -m pip install cibuildwheel==2.0.1
       - name: Build sdist
         run: |
           pipx run build --sdist
@@ -80,7 +79,7 @@ jobs:
       # Basic tests are run via the CIBW_TEST_COMMAND environment variable.
       - name: Build bdist_wheel and run tests
         run: |
-          python -m cibuildwheel --output-dir wheelhouse
+          python3 -m cibuildwheel --output-dir wheelhouse
           ls -l wheelhouse
 
       # Install the built wheel and run the full tests on this host. The full
diff --git a/open_spiel/python/CMakeLists.txt b/open_spiel/python/CMakeLists.txt
index 795b09ea8e..7b78bc9e74 100644
--- a/open_spiel/python/CMakeLists.txt
+++ b/open_spiel/python/CMakeLists.txt
@@ -280,10 +280,12 @@ endif()
 
 # Tests that are excluded when running via the installed wheel.
 # Some bundle data not shipped with the wheel (e.g. playthroughs)
+# Temporarily disable higc_referee_test until #715 is fixed.
 set(WHEEL_EXCLUDED_PYTHON_TESTS
   algorithms/response_graph_ucb_test.py
   games/tic_tac_toe_test.py
-  ../integration_tests/playthrough_test.py)
+  ../integration_tests/playthrough_test.py
+  tests/higc_referee_test.py)
 
 # Create a python test.
 foreach(py_test_file IN LISTS PYTHON_TESTS)
diff --git a/open_spiel/scripts/install.sh b/open_spiel/scripts/install.sh
index af4fc8dfa0..f9718259af 100755
--- a/open_spiel/scripts/install.sh
+++ b/open_spiel/scripts/install.sh
@@ -257,7 +257,8 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then  # Mac OSX
   [[ -x `which python3` ]] || brew install python3 || echo "** Warning: failed 'brew install python3' -- continuing"
   # On Github Actions, macOS 10.15 comes with Python 3.9.
   # We want to test multiple Python versions determined by OS_PYTHON_VERSION.
-  if [[ "$CI" && "${OS_PYTHON_VERSION}" != "3.9" ]]; then
+  if [[ "$CI" ]]; then
+    brew remove -f python@2.7
     brew install "python@${OS_PYTHON_VERSION}"
     brew unlink python@3.9
     brew link --force --overwrite "python@${OS_PYTHON_VERSION}"
@@ -272,7 +273,7 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then  # Mac OSX
 
   curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
   python3 get-pip.py
-  pip3 install virtualenv
+  python3 -m pip install virtualenv
 else
   echo "The OS '$OSTYPE' is not supported (Only Linux and MacOS is). " \
        "Feel free to contribute the install for a new OS."


Test patch:
diff --git a/open_spiel/scripts/test_wheel.sh b/open_spiel/scripts/test_wheel.sh
index 63c744ae4f..1b5937dd1a 100755
--- a/open_spiel/scripts/test_wheel.sh
+++ b/open_spiel/scripts/test_wheel.sh
@@ -40,7 +40,7 @@ if [[ "$MODE" = "full" && "$OS" = "Linux" && "$OS_PYTHON_VERSION" = "3.9" ]]; th
   sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
 fi
 
-PYBIN=${PYBIN:-"python"}
+PYBIN=${PYBIN:-"python3"}
 PYBIN=`which $PYBIN`
          
 $PYBIN -m pip install --upgrade setuptools