Mac OS - lib failing to load
rocanaan opened this issue · comments
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 get AssertionError: 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!
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.
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
.
Meanwhile, you can just go to the pyhanabi.py
file and replace PYHANABI_LIB = "libpyhanabi.so"
with PYHANABI_LIB = "libpyhanabi.dylib"
Meanwhile, you can just go to the
pyhanabi.py
file and replacePYHANABI_LIB = "libpyhanabi.so"
withPYHANABI_LIB = "libpyhanabi.dylib"
Thank you, that solved it!
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.