google-deepmind / hanabi-learning-environment

hanabi_learning_environment is a research platform for Hanabi experiments.
Apache License 2.0
644 stars 146 forks source link

Mac OS - lib failing to load #1

Closed rocanaan closed 5 years ago

rocanaan commented 5 years ago

Hello,

I am trying to run the environment on a macOS Mojave (version 10.14) and when trying to run rl_env_example.py I get

'NoneType' object has no attribute 'NewGame'

when trying to run lib.NewGame, meaning lib probably wasn't loaded.

Similarly, when running game_examply.py, I getAssertionError: lib failed to load on line 122. The instructions on the readme don't specify differences between OS, so I'd appreciate some help on this issue.

Thank you!

rocanaan commented 5 years ago

Just confirmed both examples work on Linux. Also, when running on macOS, CMake gives the following warning:

CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   pyhanabi

This warning is for project developers.  Use -Wno-dev to suppress it.

Even with the warning, import pyhanabi works, but I get the errors above when trying to run the actual examples.

tuanphuc commented 5 years ago

The error AssertionError: lib failed to load might come from the compiled library libpyhanabi.so not found in DEFAULT_LIB_PREFIXES defined in pyhanabi.py.

You might add the directory that contains libpyhanabi.so into DEFAULT_LIB_PREFIXES.

ocorcoll commented 5 years ago

Meanwhile, you can just go to the pyhanabi.py file and replace PYHANABI_LIB = "libpyhanabi.so" with PYHANABI_LIB = "libpyhanabi.dylib"

rocanaan commented 5 years ago

Meanwhile, you can just go to the pyhanabi.py file and replace PYHANABI_LIB = "libpyhanabi.so" with PYHANABI_LIB = "libpyhanabi.dylib"

Thank you, that solved it!

nolanbard commented 5 years ago

Just changed how pyhanabi.py loads libpyhanabi to handle both the typical .so and OSX .dylib file extensions. This should just work without modification now.